getJoinedGroups method

Future<List<EMGroup>> getJoinedGroups()

~english Gets all groups of the current user from the cache.

Return The group list.

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

~chinese 从本地缓存中获取当前用户加入的所有群组。

Return 群组列表。

Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 EMError。 ~end

Implementation

Future<List<EMGroup>> getJoinedGroups() async {
  Map result = await _channel.invokeMethod(ChatMethodKeys.getJoinedGroups);
  try {
    EMError.hasErrorFromResult(result);
    List<EMGroup> list = [];
    result[ChatMethodKeys.getJoinedGroups]
        ?.forEach((element) => list.add(EMGroup.fromJson(element)));
    return list;
  } on EMError catch (e) {
    throw e;
  }
}