leaveGroup static method
Future<void>
leaveGroup(
- String guid, {
- required dynamic onSuccess(
- String returnResponse
- required dynamic onError(
- CometChatException excep
In order to stop receiving updates and messages for any particular joined group.
Owner cannot leave the group , transfer the ownership before leaving the group
guid
A unique identifier for a group that logged in user wants to leave.
method could throw PlatformException with error codes specifying the cause
Implementation
static Future<void> leaveGroup(String guid, {required Function(String returnResponse)? onSuccess, required Function(CometChatException excep)? onError}) async {
try {
var result = await channel.invokeMethod('leaveGroup', {
'guid': guid,
});
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()));
}
}