fetchAllContacts method
Gets all contacts from the server.
Return The contact list.
Throws A description of the exception. See ChatError.
Implementation
Future<List<ChatContact>> fetchAllContacts() async {
Map result = await _channel.invokeMethod(ChatMethodKeys.fetchAllContacts);
try {
ChatError.hasErrorFromResult(result);
List<ChatContact> list = [];
result[ChatMethodKeys.fetchAllContacts]?.forEach((element) {
list.add(ChatContact.fromJson(element));
});
return list;
} on ChatError catch (e) {
throw e;
}
}