IocContainer class abstract
A standard interface providing inversion of control services to Dart or Flutter applications.
Constructors
Properties
- currentScope → String?
-
Gets the name of the current scope.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- onScopeChanged ↔ void Function(ScopeChange scopeChange)?
-
The callback that is called when the current scope has changed.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createScope(
{String? scopeName, FutureOr< void> onDispose()?}) → void - Creates a new registration scope.
-
get<
T extends Object> ({String? instanceName}) → T -
Gets an instance matching the specified type
T
. -
getAll<
T extends Object> () → Iterable< T> -
Gets all instances matching the specified type
T
. -
getAllAsync<
T extends Object> () → Future< Iterable< T> > -
Gets all instances matching the specified type
T
asynchronously. -
getAsync<
T extends Object> ({String? instanceName}) → Future< T> -
Gets an instance matching the specified type
T
asynchronously. -
hasScope(
String scopeName) → bool - Checks if a scope with the specified name exists.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerFactory<
T extends Object> (T factoryFunction(), {String? instanceName, bool allowReassignment = false}) → void -
Registers a factory method creating a new instance of the specified type
T
. -
registerFactoryAsync<
T extends Object> (Future< T> factoryFunc(), {String? instanceName, bool allowReassignment = false}) → void -
Registers an asynchronous factory method creating a new instance of the specified type
T
. -
registerLazySingleton<
T extends Object> (T factoryFunction(), {String? instanceName, bool allowReassignment = false, FutureOr< void> onDispose(T)?}) → void -
Registers a factory method creating a new instance of the specified type
T
. -
registerSingleton<
T extends Object> (T instance, {String? instanceName, bool allowReassignment = false, FutureOr< void> onDispose(T)?}) → void -
Registers a specific instance of type
T
. -
removeScope(
) → Future< void> - Removes the current scope from the IocContainer.
-
resetLazySingleton<
T extends Object> ({T? instance, String? instanceName, FutureOr< void> onDispose(T)?}) → FutureOr<void> - Resets an earlier created instance of a registered lazy singleton.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- container → IocContainer
-
Gets the registered IocContainer instance.
no setter
Static Methods
-
registerContainer(
IocContainer iocContainer) → void - Allows registering a custom implementation of the IocContainer interface.