dispose method

Future<void> dispose()

Disposes of the service and cleans up resources.

Implementation

Future<void> dispose() async {
  await _foregroundSubscription?.cancel();
  await _openedAppSubscription?.cancel();
  await _tokenRefreshSubscription?.cancel();
  await _authSubscription?.cancel();
  await _lifecycleSubscription?.cancel();
  await _badgeCountController.close();
  _foregroundSubscription = null;
  _openedAppSubscription = null;
  _tokenRefreshSubscription = null;
  _authSubscription = null;
  _lifecycleSubscription = null;
  _waitingForSettingsReturn = false;
  _initialized = false;
  _hasFcmTokenInitialized = false;
  logi('NotificationService disposed');
}