dispose method
Called when this object is removed from the tree permanently.
Override this to clean up any resources held by this object (cancel timers, close streams, etc).
Implementation
@override
void dispose() {
assert(
_ticker == null || !_ticker!.isTicking,
'SingleTickerProviderStateMixin.dispose called with an active ticker. '
'Dispose your AnimationController before calling super.dispose().',
);
_ticker?.dispose();
_ticker = null;
super.dispose();
}