fetchBlockIds method
~english Gets the block ids from the server.
Return The block ids obtained from the server.
Throws A description of the exception. See EMError. ~end
~chinese 从服务器获取黑名单列表。
Return 该方法调用成功会返回黑名单列表。
Throws 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 EMError。 ~end
Implementation
Future<List<String>> fetchBlockIds() async {
try {
Map result = await Client.instance.contactManager
.callNativeMethod(ChatMethodKeys.getBlockListFromServer);
EMError.hasErrorFromResult(result);
List<String> list = [];
result[ChatMethodKeys.getBlockListFromServer]?.forEach((element) {
if (element is String) {
list.add(element);
}
});
return list;
} catch (e) {
rethrow;
}
}