updateGroup static method
Future<Group?>
updateGroup({
- required Group group,
- required dynamic onSuccess(
- Group group
- required dynamic onError(
- CometChatException excep
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 {
final result = await channel.invokeMethod('updateGroup', {
'guid': group.guid,
'name': group.name,
'icon': group.icon,
'description': group.description,
'membersCount': group.membersCount,
'metadata': group.metadata == null || group.metadata!.isEmpty
? null
: json.encode(group.metadata),
'joinedAt': group.joinedAt == null
? null
: group.joinedAt!.millisecondsSinceEpoch,
'hasJoined': group.hasJoined,
'createdAt': group.createdAt == null
? null
: group.createdAt!.millisecondsSinceEpoch,
'owner': group.owner,
'updatedAt': group.updatedAt == null
? null
: group.updatedAt!.millisecondsSinceEpoch,
'tags': group.tags,
'type': group.type,
'scope': group.scope,
'password': group.password,
});
final Group res = Group.fromMap(result);
if (onSuccess != null) onSuccess(res);
return res;
} on PlatformException catch (p) {
_errorCallbackHandler(null, p, null, onError);
} catch (e) {
_errorCallbackHandler(null, null, e, onError);
}
return null;
}