getGroup static method
Future<Group?>
getGroup(
- String guid, {
- required dynamic onSuccess(
- Group retGrou
- required dynamic onError(
- CometChatException excep
Gets group details.
Migration Note: Migrated from platform channels to native Dart. Behavior and signature remain identical.
Android Reference: GroupsRequest.fetchGroup(String guid)
Retrieve information for a specific group
guid guid of group
method could throw PlatformException with error codes specifying the cause
Implementation
static Future<Group?> getGroup(String guid,
{required Function(Group retGrou)? onSuccess,
required Function(CometChatException excep)? onError}) async {
try {
// Get SDK instance
final sdk = SdkRegistry.getInstance();
// Call repository
final group = await sdk.groups.getGroup(guid);
// Call success callback
if (onSuccess != null) onSuccess(group);
return group;
} on SdkException catch (sdkEx) {
// Convert SdkException to CometChatException
final cometChatEx = CometChatException(
sdkEx.code,
sdkEx.details ?? sdkEx.message,
sdkEx.message,
);
_errorCallbackHandler(cometChatEx, null, null, onError);
} catch (e) {
// Handle unexpected errors
_errorCallbackHandler(null, null, e, onError);
}
return null;
}