updateGroup static method
Future<Group?>
updateGroup({
- required Group group,
- required dynamic onSuccess(
- Group group
- required dynamic onError(
- CometChatException excep
Updates group details.
Migration Note: Migrated from platform channels to native Dart. Behavior and signature remain identical.
Android Reference: GroupsRequest.updateGroup(Group group)
update the group details
guid an instance of class Group
method could throw PlatformException with error codes specifying the cause
Implementation
static Future<Group?> updateGroup(
{required Group group,
required Function(Group group)? onSuccess,
required Function(CometChatException excep)? onError}) async {
try {
// Get SDK instance
final sdk = SdkRegistry.getInstance();
// Call repository
final updatedGroup = await sdk.groups.updateGroup(group);
// Call success callback
if (onSuccess != null) onSuccess(updatedGroup);
return updatedGroup;
} 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;
}