getAllContactsFromServer method

  1. @Deprecated('Use fetchAllContactIds instead.')
Future<List<String>> getAllContactsFromServer()

~english Gets all the contact ids from the server.

Return The list of contact ids.

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

~chinese 从服务器获取联系人列表。

Return 联系人列表。

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

Implementation

@Deprecated('Use fetchAllContactIds instead.')

/// ~english
/// Gets all the contact ids from the server.
///
/// **Return** The list of contact ids.
///
/// **Throws** A description of the exception. See [EMError].
/// ~end
///
/// ~chinese
/// 从服务器获取联系人列表。
///
/// **Return** 联系人列表。
///
/// **Throws**  如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 [EMError]。
/// ~end
Future<List<String>> getAllContactsFromServer() async {
  Map result =
      await _channel.invokeMethod(ChatMethodKeys.getAllContactsFromServer);
  try {
    EMError.hasErrorFromResult(result);
    List<String> list = [];
    result[ChatMethodKeys.getAllContactsFromServer]?.forEach((element) {
      if (element is String) {
        list.add(element);
      }
    });
    return list;
  } on EMError catch (e) {
    throw e;
  }
}