WidgetsBindingObserver class abstract mixin

Interface for classes that register with the Widgets layer binding.

When used as a mixin, provides no-op method implementations.

See WidgetsBinding.addObserver and WidgetsBinding.removeObserver.

This class can be extended directly, to get default behaviors for all of the handlers, or can used with the implements keyword, in which case all the handlers must be implemented (and the analyzer will list those that have been omitted).

This sample shows how to implement parts of the State and WidgetsBindingObserver protocols necessary to react to application lifecycle messages. See didChangeAppLifecycleState.

To create a local project with this code sample, run:
flutter create --sample=widgets.WidgetsBindingObserver.1 mysample

To respond to other notifications, replace the didChangeAppLifecycleState method above with other methods from this class.





hashCode int
The hash code for this object.
runtimeType Type
A representation of the runtime type of the object.


didChangeAccessibilityFeatures() → void
Called when the system changes the set of currently active accessibility features.
didChangeAppLifecycleState(AppLifecycleState state) → void
Called when the system puts the app in the background or returns the app to the foreground.
didChangeLocales(List<Locale>? locales) → void
Called when the system tells the app that the user's locale has changed. For example, if the user changes the system language settings.
didChangeMetrics() → void
Called when the application's dimensions change. For example, when a phone is rotated.
didChangePlatformBrightness() → void
Called when the platform brightness changes.
didChangeTextScaleFactor() → void
Called when the platform's text scale factor changes.
didHaveMemoryPressure() → void
Called when the system is running low on memory.
didPopRoute() Future<bool>
Called when the system tells the app to pop the current route. For example, on Android, this is called when the user presses the back button.
didPushRoute(String route) Future<bool>
Called when the host tells the application to push a new route onto the navigator.
didPushRouteInformation(RouteInformation routeInformation) Future<bool>
Called when the host tells the application to push a new RouteInformation and a restoration state onto the router.
didRequestAppExit() Future<AppExitResponse>
Called when a request is received from the system to exit the application.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.