unmount method

  1. @override
void unmount ()
override

Transition from the "inactive" to the "defunct" lifecycle state.

Called when the framework determines that an inactive element will never be reactivated. At the end of each animation frame, the framework calls unmount on any remaining inactive elements, preventing inactive elements from remaining inactive for longer than a single animation frame.

After this function is called, the element will not be incorporated into the tree again.

See the lifecycle documentation for Element for additional information.

Implementation

@override
void unmount() {
  super.unmount();
  _state.dispose();
  assert(() {
    if (_state._debugLifecycleState == _StateLifecycle.defunct)
      return true;
    throw FlutterError.fromParts(<DiagnosticsNode>[
      ErrorSummary('${_state.runtimeType}.dispose failed to call super.dispose.'),
      ErrorDescription(
        'dispose() implementations must always call their superclass dispose() method, to ensure '
       'that all the resources used by the widget are fully released.'
      )
    ]);
  }());
  _state._element = null;
  _state = null;
}