getAllContactsFromDB method

  1. @Deprecated('Use getAllContactIds instead.')
Future<List<String>> getAllContactsFromDB()

~english Gets the contact ids from the local database.

Return The contact list ids.

Throws A description of the exception. See EMError. ~end

~chinese 从数据库获取好友列表。

Return 调用成功会返回好友列表。

Throws 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 EMError。 ~end

Implementation

@Deprecated('Use getAllContactIds instead.')

/// ~english
/// Gets the contact ids from the local database.
///
/// **Return** The contact list ids.
///
/// **Throws** A description of the exception. See [EMError].
/// ~end
///
/// ~chinese
/// 从数据库获取好友列表。
///
/// **Return** 调用成功会返回好友列表。
///
/// **Throws**  如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。
/// ~end
Future<List<String>> getAllContactsFromDB() async {
  Map result =
      await _channel.invokeMethod(ChatMethodKeys.getAllContactsFromDB);
  try {
    EMError.hasErrorFromResult(result);
    List<String> list = [];
    result[ChatMethodKeys.getAllContactsFromDB]?.forEach((element) {
      if (element is String) {
        list.add(element);
      }
    });

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