Control class
Service Locator with Factory and object Initialization. Start with Control.initControl to initialize ControlFactory.
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
-
Internal debug mark.
no setter
- factory → ControlFactory
-
Returns instance of ControlFactory.
no setter
- isInitialized → bool
-
Checks if ControlFactory is initialized.
no setter
Static Methods
-
add<
T> ({dynamic key, required InitFactory< T> init}) → dynamic - Adds Factory for later use - Control.init or Control.get.
-
evaluate(
dynamic object, ValueCallback callback) → void -
Executes proper function based on object type, then retrieve result via
callback. Type - get object from ControlFactory Function - call given function Future - waits to complete -
get<
T> ({dynamic key, dynamic args, bool withInjector = true}) → T? -
//
//
//
Returns object of requested type by given
keyor by Type from ControlFactory. Givenargsare passed to Initializable.init if new instance of object is constructed. -
getAsync<
T> ({dynamic key, dynamic args, bool withInjector = true}) → Future< T?> -
Returns object of requested type by given
keyor by Type from ControlFactory. Givenargsare passed to Initializable.init if new instance of object is constructed. -
init<
T> ({Type? key, dynamic args}) → T? -
Returns new object of requested type by given
keyor by Type from ControlFactory. Givenargsare passed to Initializable.init. -
initControl(
{bool? debug, Map? entries, Map< Type, InitFactory> ? factories, List<ControlModule> modules = const [], Future initAsync()?}) → bool - // // // Initializes instance of ControlFactory.
-
maybe<
T> ({dynamic key}) → T? -
Returns object of requested type by given
keyor by Type from ControlFactory. BUT only if object is found in internal store -
newFactory(
) → ControlFactory - Creates new standalone instance of Control Factory.
-
remove<
T> ({dynamic key, bool dispose = false}) → int -
Removes specific object with given
keyor by Type from ControlFactory. If object of givenkeyis not found, then all instances ofTare removed. Setdisposeto dispose removed object. -
resolve<
T> (dynamic source, {dynamic key, dynamic args, T? defaultValue()?}) → T? -
Executes sequence of functions to retrieve expected object.
Look up in
sourcefor item via Parse.getArg and if object is not found then ControlFactory.get is executed. After all,defaultValueis used. Returns object fromsourcethen ControlFactory thendefaultValue. -
set<
T> ({dynamic key, required T value}) → dynamic -
Stores
valuewith givenkeyin ControlFactory. When givenkeyis null, then key isTor generated from Type of givenvalue- check ControlFactory.keyOf for more info. Object with samekeypreviously stored in factory is overridden. Returnskeyof the storedvalue. -
use<
T> ({dynamic key, dynamic args, required T value(), bool store = true}) → T -
Returns object of requested type by given
keyor by Type from ControlFactory. If object is not found, thenvalueis used. Whenvalueis used andstoreis set, thenvaluewill be stored into ControlFactory for future lookups.