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 key or by Type from ControlFactory. Given args are 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 key or by Type from ControlFactory. Given args are 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 key or by Type from ControlFactory. Given args are 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 key or 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 key or by Type from ControlFactory. If object of given key is not found, then all instances of T are removed. Set dispose to 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 source for item via Parse.getArg and if object is not found then ControlFactory.get is executed. After all, defaultValue is used. Returns object from source then ControlFactory then defaultValue.
set<T>({dynamic key, required T value}) → dynamic
Stores value with given key in ControlFactory. When given key is null, then key is T or generated from Type of given value - check ControlFactory.keyOf for more info. Object with same key previously stored in factory is overridden. Returns key of the stored value.
use<T>({dynamic key, dynamic args, required T value(), bool store = true}) → T
Returns object of requested type by given key or by Type from ControlFactory. If object is not found, then value is used. When value is used and store is set, then value will be stored into ControlFactory for future lookups.