updateGroupMemberScope static method

Future<String?> updateGroupMemberScope({
  1. required String guid,
  2. required String uid,
  3. required String scope,
  4. required dynamic onSuccess(
    1. String result
    )?,
  5. required dynamic onError(
    1. CometChatException excep
    )?,
})

In order to change the scope of a group member

guid The GUID of the group for which the member's scope needs to be changed

uid The UID of the member whose scope you would like to change

the updated scope of the member. can be CometChatMemberScope.admin , CometChatMemberScope.participant, CometChatMemberScope.moderator

method could throw PlatformException with error codes specifying the cause

Implementation

static Future<String?> updateGroupMemberScope({
  required String guid,
  required String uid,
  required String scope,
  required Function(String result)? onSuccess,
  required Function(CometChatException excep)? onError}
) async {
  try {
    final result = await channel.invokeMethod('updateGroupMemberScope', {
      'guid': guid,
      'uid': uid,
      'scope': scope,
    });
    if(onSuccess != null) onSuccess(result);
    return result;
  } on PlatformException catch (platformException) {
    if(onError != null) onError(CometChatException(platformException.code, platformException.details, platformException.message));
  } catch (e) {
    debugPrint("Error: $e");
    if(onError != null) onError(CometChatException(ErrorCode.errorUnhandledException, e.toString() , e.toString()));
  }
  return null;
}