BindingBase class Null safety

Base class for mixins that provide singleton services (also known as "bindings").

To use this class in an on clause of a mixin, inherit from it and implement initInstances(). The mixin is guaranteed to only be constructed once in the lifetime of the app (more precisely, it will assert if constructed twice in debug mode).

The top-most layer used to write the application will have a concrete class that inherits from BindingBase and uses all the various BindingBase mixins (such as ServicesBinding). For example, the Widgets library in Flutter introduces a binding called WidgetsFlutterBinding. The relevant library defines how to create the binding. It could be implied (for example, WidgetsFlutterBinding is automatically started from runApp), or the application might be required to explicitly call the constructor.

Implementers

Constructors

BindingBase()
Default abstract constructor for bindings. [...]

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
locked bool
Whether lockEvents is currently locking events. [...]
@protected, read-only
platformDispatcher PlatformDispatcher
The ui.PlatformDispatcher to which this binding is bound. [...]
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
window SingletonFlutterWindow
The main window to which this binding is bound. [...]
read-only

Methods

initInstances() → void
The initialization method. Subclasses override this method to hook into the platform and otherwise configure their services. Subclasses must call "super.initInstances()". [...]
initServiceExtensions() → void
Called when the binding is initialized, to register service extensions. [...]
lockEvents(Future<void> callback()) Future<void>
Locks the dispatching of asynchronous events and callbacks until the callback's future completes. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
performReassemble() Future<void>
This method is called by reassembleApplication to actually cause the application to reassemble, e.g. after a hot reload. [...]
postEvent(String eventKind, Map<String, dynamic> eventData) → void
All events dispatched by a BindingBase use this method instead of calling developer.postEvent directly so that tests for BindingBase can track which events were dispatched by overriding this method.
reassembleApplication() Future<void>
Cause the entire application to redraw, e.g. after a hot reload. [...]
registerBoolServiceExtension({required String name, required AsyncValueGetter<bool> getter, required AsyncValueSetter<bool> setter}) → void
Registers a service extension method with the given name (full name "ext.flutter.name"), which takes a single argument "enabled" which can have the value "true" or the value "false" or can be omitted to read the current value. (Any value other than "true" is considered equivalent to "false". Other arguments are ignored.) [...]
registerNumericServiceExtension({required String name, required AsyncValueGetter<double> getter, required AsyncValueSetter<double> setter}) → void
Registers a service extension method with the given name (full name "ext.flutter.name"), which takes a single argument with the same name as the method which, if present, must have a value that can be parsed by double.parse, and can be omitted to read the current value. (Other arguments are ignored.) [...]
registerServiceExtension({required String name, required ServiceExtensionCallback callback}) → void
Registers a service extension method with the given name (full name "ext.flutter.name"). [...]
registerSignalServiceExtension({required String name, required AsyncCallback callback}) → void
Registers a service extension method with the given name (full name "ext.flutter.name"), which takes no arguments and returns no value. [...]
registerStringServiceExtension({required String name, required AsyncValueGetter<String> getter, required AsyncValueSetter<String> setter}) → void
Registers a service extension method with the given name (full name "ext.flutter.name"), which optionally takes a single argument with the name "value". If the argument is omitted, the value is to be read, otherwise it is to be set. Returns the current value. [...]
toString() String
A string representation of this object. [...]
override
unlocked() → void
Called by lockEvents when events get unlocked. [...]

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Properties

debugReassembleConfig DebugReassembleConfig?
Additional configuration used by the framework during hot reload. [...]
read / write