deactivate method
- @mustCallSuper
@mustCallSuper
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.
This is (indirectly) called by deactivateChild.
See the lifecycle documentation for Element for additional information.
Implementation
@mustCallSuper
void deactivate() {
assert(_debugLifecycleState == _ElementLifecycle.active);
assert(widget != null);
assert(depth != null);
assert(_active);
if (_dependencies != null && _dependencies.isNotEmpty) {
for (InheritedElement dependency in _dependencies)
dependency._dependents.remove(this);
// For expediency, we don't actually clear the list here, even though it's
// no longer representative of what we are registered with. If we never
// get re-used, it doesn't matter. If we do, then we'll clear the list in
// activate(). The benefit of this is that it allows Element's activate()
// implementation to decide whether to rebuild based on whether we had
// dependencies here.
}
_inheritedWidgets = null;
_active = false;
assert(() { _debugLifecycleState = _ElementLifecycle.inactive; return true; }());
}