deactivate method

  1. @mustCallSuper
  2. @visibleForOverriding
void deactivate()
inherited

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

The framework calls this method when a previously active element is moved to the list of inactive elements. While in the inactive state, the element will not appear on screen. The element can remain in the inactive state only until the end of the current animation frame. At the end of the animation frame, if the element has not be reactivated, the framework will unmount the element.

In case of an uncaught exception when rebuild a widget subtree, the framework also calls this method on the failing subtree to make sure the widget tree is in a relatively consistent state. The deactivation of such subtrees are performed only on a best-effort basis, and the errors thrown during deactivation will not be rethrown.

This is indirectly called by deactivateChild.

See the lifecycle documentation for Element for additional information.

Implementations of this method should end with a call to the inherited method, as in super.deactivate().

Implementation

@mustCallSuper
@visibleForOverriding
void deactivate() {
  assert(_lifecycleState == _ElementLifecycle.active);
  assert(_widget != null); // Use the private property to avoid a CastError during hot reload.
  _ensureDeactivated();
}