Control class

Main Control static class. Provides easy access to most usable Control classes. These objects are stored in ControlFactory with their Type key. Some of this classes also has custom Provider with base functionality.

Start with Control.initControl to initialize ControlFactory and other core Control objects.

ControlBroadcast - Sends data and events via global broadcast. Use BroadcastProvider for base and direct workflow. BaseLocalization - Loads and stores localization data. Use it directly via LocalizationProvider as mixin or to find closest BaseLocalizationDelegate in Widget Tree. RouteStore - Stores route builders and their paths and settings. Use ControlRoute.of to retrieve route. Then is possible to alter this route with new settings, path or transition. ControlRootScope - This class provides access to root of Widget Tree and to ControlRootState. But only if ControlRoot Widget is used. BasePrefs - Wrapper around SharedPreferences.

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

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

Static Properties

broadcast ControlBroadcast
Returns default instance of ControlBroadcast - this instance is stored in ControlFactory. Use BroadcastProvider for base broadcast operations.
no setter
debug bool
Checks the current settings of debug mode (this mode is set independently to kDebugMode) and is usable in profile/release mode. This value is also provided to BaseLocalization during Control.initControl and to various other classes.
no setter
factory ControlFactory
Returns instance of ControlFactory.
no setter
injector Injector?
Returns default instance of Injector - this instance is stored in ControlFactory. Injector is set via Control.initControl or ControlFactory.setInjector.
no setter
isInitialized bool
Checks if ControlFactory is initialized.
no setter

Static Methods

add<T>({dynamic key, required InitFactory<T> init}) → dynamic
Stores init Factory for later use - Control.init or Control.get.
get<T>({dynamic key, dynamic args, bool withInjector = true}) → T?
// // // Returns object of requested type by given key or by Type from ControlFactory. When args are not empty and object is Initializable, then Initializable.init is called. Set withInjector to re-inject stored object.
init<T>({Type? key, dynamic args}) → T?
Returns new object of requested Type via initializer in ControlFactory. When args are not null and initialized object is Initializable then Initializable.init is called.
initControl({bool? debug, Map? entries, Map<Type, InitFactory>? factories, Injector? injector, List<ControlModule> modules = const [], Future initAsync()?}) bool
// // // Initializes ControlFactory and other core Control objects. Loads BasePrefs and BaseLocalization, also builds RouteStore.
inject<T>(dynamic item, {dynamic args}) → void
Injects and initializes given item with args. Initializable.init is called only when args are not null.
newFactory() ControlFactory
Creates new standalone instance of Control Factory.
remove<T>({dynamic key, bool dispose = false}) int
Removes specific object with given key or by Type from ControlFactory. When given key is null, then key is T - check ControlFactory.keyOf for more info. If object of given key is not found, then all instances of T are removed. Set dispose to dispose removed object/s.
resolve<T>(dynamic source, {dynamic key, dynamic args, T? defaultValue}) → T?
Executes sequence of functions to retrieve expected object. Look up in source for item via Parse.getArg and if object is not found then ControlFactory.get / ControlFactory.init is executed. Returns object from source or via ControlFactory or defaultValue. nullable
set<T>({dynamic key, required T value}) → dynamic
Stores value with given key in ControlFactory. Object with same key previously stored in factory is overridden. When given key is null, then key is T or generated from Type of given value - check ControlFactory.keyOf for more info. Returns key of the stored value.