getAllContactsFromServer method

Future<List<String>> getAllContactsFromServer()

Gets all the contacts from the server.

Return The list of contacts.

Throws A description of the exception. See ChatError.

Implementation

Future<List<String>> getAllContactsFromServer() async {
  Map result =
      await _channel.invokeMethod(ChatMethodKeys.getAllContactsFromServer);
  try {
    ChatError.hasErrorFromResult(result);
    List<String> list = [];
    result[ChatMethodKeys.getAllContactsFromServer]?.forEach((element) {
      if (element is String) {
        list.add(element);
      }
    });
    return list;
  } on ChatError catch (e) {
    throw e;
  }
}