dispose method

void dispose()

Dispose of resources.

Safe to call on a singleton — reinitializes internal resources so the manager can be used again after a subsequent init call.

Implementation

void dispose() {
  WidgetsBinding.instance.removeObserver(this);
  _themeStreamController.close();
  _themeNotifier.dispose();

  // Reinitialize resources so the singleton remains usable
  _themeStreamController = StreamController<String>.broadcast();
  _themeNotifier = ValueNotifier<String>('');
  _isInitialized = false;
}