dispose method
- @mustCallSuper
- @protected
inherited
Called when this object is removed from the tree permanently.
The framework calls this method when this State
object will never
build again. After the framework calls dispose, the State
object is
considered unmounted and the mounted property is false. It is an error
to call setState at this point. This stage of the lifecycle is terminal:
there is no way to remount a State
object that has been disposed.
Subclasses should override this method to release any resources retained by this object (e.g., stop any active animations).
Implementations of this method should end with a call to the inherited
method, as in super.dispose()
.
See also:
- deactivate, which is called prior to dispose.
Implementation
@mustCallSuper
@protected
void dispose() {
assert(_debugLifecycleState == _StateLifecycle.ready);
assert(() {
_debugLifecycleState = _StateLifecycle.defunct;
return true;
}());
}