fetchContacts method
从服务器分页获取友。
Param cursor
分页的游标,第一页可以不传。
Param pageSize
分页的大小。
Return 好友列表获取结果。
Throws 如果有方法调用的异常会在这里抛出,可以看到具体错误原因。请参见 ChatError。
Implementation
Future<ChatCursorResult<ChatContact>> fetchContacts({
String? cursor,
int pageSize = 20,
}) async {
Map map = {"pageSize": pageSize};
map.putIfNotNull('cursor', cursor);
Map result = await _channel.invokeMethod(
ChatMethodKeys.fetchContacts,
map,
);
try {
ChatError.hasErrorFromResult(result);
return ChatCursorResult.fromJson(result[ChatMethodKeys.fetchContacts],
dataItemCallback: (map) {
return ChatContact.fromJson(map);
});
} on ChatError catch (e) {
throw e;
}
}