getGroupWithId method

Future<ChatGroup?> getGroupWithId(
  1. String groupId

Gets the group instance from the cache by group ID.

Param groupId The group ID.

Return The group instance. Returns null if the group does not exist.

Throws A description of the exception. See ChatError.


Future<ChatGroup?> getGroupWithId(String groupId) async {
  Map req = {'groupId': groupId};
  Map result =
      await _channel.invokeMethod(ChatMethodKeys.getGroupWithId, req);
  try {
    if (result.containsKey(ChatMethodKeys.getGroupWithId)) {
      return ChatGroup.fromJson(result[ChatMethodKeys.getGroupWithId]);
    } else {
      return null;
  } on ChatError catch (e) {
    throw e;