detachedAppLifecycleState method

  1. @override
  2. @protected
  3. @mustCallSuper
void detachedAppLifecycleState()
inherited

Calls the deactivate() and dispose() functions in all the app's StateX class objects It's success will depending on the hosting operating system: https://github.com/flutter/flutter/issues/124945#issuecomment-1514159238

Implementation

@override
@protected
@mustCallSuper
void detachedAppLifecycleState() {
  //
  forEachState((state) {
    //
    try {
      state.deactivate();
    } catch (e, stack) {
      // An error in the error handler. Record the error
      recordException(e, stack);
      _onErrorInHandler();
    }

    try {
      if (!state.disposed) {
        state.dispose();
      }
    } catch (e, stack) {
      // An error in the error handler. Record the error
      recordException(e, stack);
      _onErrorInHandler();
    }
  }, reversed: true, remove: this);
}