dispose method

void dispose()

Releases each resource.

Implementation

void dispose() {
  app.remoteConfig.removeListener(_onRemoteConfigChange);

  _rootLogPrintSubscription?.cancel();
  _rootLogPrintSubscription = null;

  if (_originalDebugPrint != null) {
    debugPrint = _originalDebugPrint!;
    _originalDebugPrint = null;
  }

  _rootLogDelegateSubscription?.cancel();
  _rootLogDelegateSubscription = null;

  if (_originalOnFlutterError != null) {
    FlutterError.onError = _originalOnFlutterError;
    _originalOnFlutterError = null;
  }

  if (!kIsWeb) {
    Zone.root.run(() {
      // In most cases, _originalOnUnhandledError is assumed to be set in the
      // rootZone, but this is not guaranteed.
      // Therefore, this process does not ensure that _originalOnUnhandledError
      // returns to the Zone it originally belonged to.
      PlatformDispatcher.instance.onError = _originalOnUnhandledError;
      _originalOnUnhandledError = null;
    });
  }

  _reportStreamController.close();
}