unmount method

  1. @mustCallSuper
void unmount ()
@mustCallSuper

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

@mustCallSuper
void unmount() {
  assert(_debugLifecycleState == _ElementLifecycle.inactive);
  assert(widget != null);
  assert(depth != null);
  assert(!_active);
  if (widget.key is GlobalKey) {
    final GlobalKey key = widget.key;
    key._unregister(this);
  }
  assert(() { _debugLifecycleState = _ElementLifecycle.defunct; return true; }());
}