I have a contact list, where I would like to send the givenName, familyName and displayName to an api using json string..
final contacts =
(await ContactsService.getContacts(withThumbnails: false)).toList();
I tried but unable to created nested array:
List<dynamic> list = new List<dynamic>();
for (final contact in contacts) {
list.add(contact.givenName);
}
print(list);
I would like it something like:
[
{"id":1,"givenName":"Joe","familyname":"Walker"},
{"id":2,"givenName":"Zoe","familyname":"Sleeper"}
];