banGroupMember static method

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

Admin or Moderator of a group can ban a member of the group

guid The GUID of the group from which user is to be banned

uid The UID of the user to be banned

Banned user cannot rejoin the group.

method could throw PlatformException with error codes specifying the cause

Implementation

static Future<String?> banGroupMember(
    {required String guid,
    required String uid,
    required Function(String result)? onSuccess,
    required Function(CometChatException excep)? onError}) async {
  try {
    final result = await channel.invokeMethod('banGroupMember', {
      'guid': guid,
      'uid': uid,
    });
    if (onSuccess != null) onSuccess(result);
    return result;
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
  return null;
}