getAllContactsFromDB method

Future<List<String>> getAllContactsFromDB()

Gets the contact list from the local database.

Return The contact list.

Throws A description of the exception. See ChatError.

Implementation

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

    return list;
  } on ChatError catch (e) {
    throw e;
  }
}