clearPushRegistrations method

Future<void> clearPushRegistrations()

Unregisters all the mobile devices for the user.

Implementation

Future<void> clearPushRegistrations() async {
  if (_headlessWebView == null) {
    throw StateError(
        'The clearPushRegistrations method cannot be called after destroying the session');
  }

  if (!_completer.isCompleted) {
    if (_me == null) {
      throw StateError(
          'The me property needs to be set for the Session object before calling clearPushRegistrations');
    }

    if (kDebugMode) {
      print(
          '📗 session clearPushRegistrations: !_completer.isCompleted, awaiting for _completer.future');
    }
    await _completer.future;
  }

  if (kDebugMode) {
    print('📗 session clearPushRegistrations: Clearing push notifications');
  }

  await _executeAsync('await session.clearPushRegistrations();');
}