onPause method
Called when the widget is no longer in focus but may be visible. Use this to:
- Pause animations
- Pause media playback
- Stop real-time updates
- Save game state
- Cancel refresh timers
Example:
@override
void onPause() {
super.onPause();
_pauseAnimations();
_videoController.pause();
_timer?.cancel();
_streamSubscription?.pause();
_gameEngine.pause();
_saveCurrentState();
}
Implementation
@protected
void onPause() {}