getJoinedGroups method

Future<List<ChatGroup>> getJoinedGroups()

Gets all groups of the current user from the cache.

Return The group list.

Throws A description of the exception. See ChatError.

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;
  }
}