getAllContactIds method

Future<List<String>> getAllContactIds()

从数据库获取好友列表。

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

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

Implementation

Future<List<String>> getAllContactIds() async {
  try {
    Map result = await platform_interface.Client.instance.contactManager
        .callNativeMethod(ChatMethodKeys.getAllContactsFromDB);
    ChatError.hasErrorFromResult(result);
    List<String> list = [];
    result[ChatMethodKeys.getAllContactsFromDB]?.forEach((element) {
      if (element is String) {
        list.add(element);
      }
    });

    return list;
  } catch (e) {
    rethrow;
  }
}