clearPushRegistrations method
Unregisters all the mobile devices for the user.
Implementation
Future<void> clearPushRegistrations() async {
// We check the completer first because _headlessWebView may be null because we haven't loaded the version asset yet.
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 (_headlessWebView == null) {
throw StateError(
'The clearPushRegistrations method cannot be called after destroying the session');
}
if (kDebugMode) {
print('📗 session clearPushRegistrations: Clearing push notifications');
}
_execute('session.clearPushRegistrations();');
}