unregisterPushToken static method
Unregisters the push notification token for the logged-in user.
This method makes an asynchronous call to the CometChat server to remove the associated
push notification token, thus preventing further push notifications from being sent to the user's device.
Upon unregistering successfully, onSuccess
is invoked with a confirmation response.
If an error occurs, onError
is called with a CometChatException.
Returns a Future<String?> which completes with a confirmation response if the operation is successful, or null if an error occurs.
Implementation
static Future<String?> unregisterPushToken(
{Function(String response)? onSuccess,
Function(CometChatException e)? onError}) async {
try {
final result = await channel.invokeMethod('unregisterPushToken');
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;
}