resetPushPreferences static method
- {dynamic onSuccess(
- PushPreferences pushPreferences
- dynamic onError( )?}
Resets push notification preferences to their default values for the logged-in user.
This method makes an asynchronous call to the CometChat server to reset the PushPreferences
.
Upon successful reset, onSuccess
is invoked with the reset PushPreferences
object.
If an error occurs, onError
is called with a CometChatException.
Returns a Future<PushPreferences?> which completes with the reset preferences, or null if an error occurs.
Implementation
static Future<PushPreferences?> resetPushPreferences({Function(PushPreferences pushPreferences)? onSuccess, Function(CometChatException e)? onError}) async {
try {
final result = await channel.invokeMethod('resetPushPreferences');
final pushPreferencesObj = PushPreferences.fromMap(result);
if(onSuccess != null) onSuccess(pushPreferencesObj);
return pushPreferencesObj;
} on PlatformException catch (platformException) {
if(onError != null) onError(CometChatException(platformException.code, platformException.details, platformException.message));
} catch (e) {
if(onError != null) onError(CometChatException(ErrorCode.errorUnhandledException, e.toString() , e.toString()));
}
return null;
}