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