getJoinedGroups method
~english Gets all groups of the current user from the cache.
Return The group list.
Throws A description of the exception. See ChatError. ~end
~chinese 从本地缓存中获取当前用户加入的所有群组。
Return 群组列表。
Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 ChatError。 ~end
Implementation
Future<List<ChatGroup>> getJoinedGroups() async {
Map result = await _channel.invokeMethod(ChatMethodKeys.getJoinedGroups);
try {
ChatError.hasErrorFromResult(result);
List<ChatGroup> list = [];
result[ChatMethodKeys.getJoinedGroups]
?.forEach((element) => list.add(ChatGroup.fromJson(element)));
return list;
} on ChatError catch (e) {
throw e;
}
}