getJoinedGroups method

Future<List<ChatGroup>> getJoinedGroups()

Gets all group information of the current user from the local cache.

Returns The list of groups.

Throws Exception description, see ChatError.

Implementation

Future<List<ChatGroup>> getJoinedGroups() async {
  try {
    Map result = await platform_interface.Client.instance.groupManager
        .callNativeMethod(ChatMethodKeys.getJoinedGroups);
    ChatError.hasErrorFromResult(result);
    List<ChatGroup> list = [];
    result[ChatMethodKeys.getJoinedGroups]
        ?.forEach((element) => list.add(ChatGroup.fromJson(element)));
    return list;
  } catch (e) {
    rethrow;
  }
}