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. Whenargs
are not empty and object is Initializable, then Initializable.init is called. SetwithInjector
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
andBaseLocalization
, also buildsRouteStore
. -
inject<
T> (dynamic item, {dynamic args}) → void -
Injects and initializes given
item
withargs
. Initializable.init is called only whenargs
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 givenkey
is null, then key isT
- check ControlFactory.keyOf for more info. If object of givenkey
is not found, then all instances ofT
are removed. Setdispose
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 fromsource
or via ControlFactory ordefaultValue
. nullable -
set<
T> ({dynamic key, required T value}) → dynamic -
Stores
value
with givenkey
in ControlFactory. Object with samekey
previously stored in factory is overridden. When givenkey
is null, then key isT
or generated from Type of givenvalue
- check ControlFactory.keyOf for more info. Returnskey
of the storedvalue
.