unregisterAllPushToken method

Future<void> unregisterAllPushToken()

Unregisters all push token

Implementation

Future<void> unregisterAllPushToken() async {
  SharedPreferences prefs = await SharedPreferences.getInstance();

  return _int.api
      .send<int?>(UserPushTokenUnregisterAllRequest())
      .then((value) {
    //* If deviceTokenLastDeletedAt is not NULL then update the state
    if (value != null) {
      prefs.setInt(
        prefDeviceTokenLastDeletedAt,
        value,
      );
    }

    //* Remove all token from shared preference
    prefs.remove(prefDeviceToken);
  });
}