BindingBase class

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 checked 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

locked bool
Whether lockEvents is currently locking events. [...]
@protected, read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

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()". [...]
@mustCallSuper, @protected
initServiceExtensions() → void
Called when the binding is initialized, to register service extensions. [...]
@mustCallSuper, @protected
lockEvents(Future<void> callback()) Future<void>
Locks the dispatching of asynchronous events and callbacks until the callback's future completes. [...]
@protected
performReassemble() Future<void>
This method is called by reassembleApplication to actually cause the application to reassemble, e.g. after a hot reload. [...]
@mustCallSuper, @protected
reassembleApplication() Future<void>
Cause the entire application to redraw, e.g. after a hot reload. [...]
registerBoolServiceExtension({String name, AsyncValueGetter<bool> getter, 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.) [...]
@protected
registerNumericServiceExtension({String name, AsyncValueGetter<double> getter, 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.) [...]
@protected
registerServiceExtension({String name, ServiceExtensionCallback callback }) → void
Registers a service extension method with the given name (full name "ext.flutter.name"). [...]
@protected
registerSignalServiceExtension({String name, 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. [...]
@protected
registerStringServiceExtension({String name, AsyncValueGetter<String> getter, 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. [...]
@protected
toString() String
Returns a string representation of this object.
override
unlocked() → void
Called by lockEvents when events get unlocked. [...]
@mustCallSuper, @protected
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited

Operators

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