dispose method
The framework calls this method when this StateX object will never
build again.
Note: YOU WILL HAVE NO IDEA WHEN THIS WILL RUN in the Framework.
Implementation
@mustCallSuper
void dispose() {
/// The framework calls this method when this [StateX] object will never
/// build again. The [State] object's lifecycle is terminated.
/// Subclasses should override this method to release any resources retained
/// by this object (e.g., stop any active animations).
// Clear its ChangeNotifier
_disposeChangeNotifier();
/// Clean up memory
disposeSetState();
// App State object
_appStateX = null;
// If instantiated in a factory constructor
// Note: You don't know when this function will fire!
// _initStateCalled = false;
// Optionally call super for debugPrint()
assert(() {
if (_debugPrintEvents) {
debugPrint('$_consoleLeadingLine dispose() in $_consoleClassName');
}
return true;
}());
}