WidgetBindingReducer<Action> mixin

A mixin that maps platform WidgetsBindingObserver events to store actions.

Implement the methods you care about to return actions that will be dispatched to the store. Return null to ignore an event.

class MyObserver with WidgetBindingReducer<AppAction> {
  @override
  AppAction? didChangePlatformBrightness(Brightness brightness) =>
    AppAction.setBrightness(brightness);

  @override
  AppAction? didChangeLocales(List<Locale>? locales) =>
    locales != null ? AppAction.setLocale(locales.first) : null;
}

Properties

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

Methods

didChangeAccessibilityFeatures() → Action?
Called when accessibility features change.
didChangeAppLifecycleState(AppLifecycleState state) → Action?
Called when the app lifecycle state changes (paused, resumed, etc.).
didChangeLocales(List<Locale>? locales) → Action?
Called when the system locales change.
didChangeMetrics() → Action?
Called when screen metrics change (size, orientation, etc.).
didChangePlatformBrightness(Brightness brightness) → Action?
Called when the platform brightness (dark/light mode) changes.
didChangeTextScaleFactor() → Action?
Called when the text scale factor changes.
didHaveMemoryPressure() → Action?
Called when the system is under memory pressure.
didRequestAppExit() → Action?
Called when the user requests to exit the app.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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