getGroupWithId method
- String groupId
Gets the group instance, creates it if it does not exist.
Param groupId The group ID.
Returns The group instance.
Throws Exception description, see ChatError.
Implementation
Future<ChatGroup?> getGroupWithId(String groupId) async {
try {
Map req = {'groupId': groupId};
Map result = await platform_interface.Client.instance.groupManager
.callNativeMethod(ChatMethodKeys.getGroupWithId, req);
ChatError.hasErrorFromResult(result);
if (result.containsKey(ChatMethodKeys.getGroupWithId)) {
return ChatGroup.fromJson(result[ChatMethodKeys.getGroupWithId]);
} else {
return null;
}
} catch (e) {
rethrow;
}
}