InstanceCollection class
Main class to store instances of kore elements
Contains internal methods to manage instances
Properties
-
builders
→ HashMap<
String, Function> -
final
-
buildingInstances
→ HashMap<
String, List< int> > -
final
- checkForCyclicDependencies ↔ bool
-
getter/setter pair
-
container
→ ScopedContainer<
BaseKoreInstance> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
{required String type, DefaultInputType? params, int? index, String? scope}) → void - Adds instance in collection
-
addAsync(
{required String type, DefaultInputType? params, int? index, String? scope}) → Future< void> - Adds instance in collection
-
addBuilder<
KInstance extends BaseKoreInstance> (Function builder) → void - Adds builder for given instance type
-
addExisting(
{String scope = BaseScopes.global, required BaseKoreInstance instance}) → void - Adds existing instance to collection
-
addTest<
KInstance extends BaseKoreInstance> ({String scope = BaseScopes.global, required BaseKoreInstance instance, dynamic params, bool overrideMainInstance = true}) → void - Adds test instance for given instance type
-
addUninitialized<
InputState> ({required String type, InputState? params, int? index, String? scope}) → void - Adds instance in collection
-
addWithParams<
InputState> ({required String type, InputState? params, int? index, String? scope}) → void - Adds instance in collection
-
addWithParamsAsync<
InputState> ({required String type, InputState? params, int? index, String? scope}) → Future< void> - Adds instance in collection
-
all(
String scope) → List< BaseKoreInstance> - Returns all instances in given scope
-
clear(
) → void - Utility method to clear collection
-
constructAndInitializeInstance<
KInstance extends BaseKoreInstance> (String id, {dynamic params, bool withNoConnections = false, void beforeInitialize(dynamic)?}) → KInstance -
constructAndInitializeInstanceAsync<
KInstance extends BaseKoreInstance> (String id, {dynamic params, bool withNoConnections = false, void beforeInitialize(dynamic)?}) → Future< KInstance> -
constructInstance<
KInstance extends BaseKoreInstance> (String id) → KInstance - Returns built instance for given type id
-
decreaseReferencesInScope(
String scope, Type type, {int index = 0}) → void - Decreases reference count in given scope for given type
-
find<
InstanceType> (String scope) → InstanceType? - Tries to find object in scope
-
finishBuildingInstance(
String typeId, int? index) → void - Marks instance and built for cyclic check
-
forceGet<
KInstance extends BaseKoreInstance> ({int? index, String scope = BaseScopes.global}) → KInstance? - Forcibly tries to get instance for type
-
get<
KInstance extends BaseKoreInstance> ({DefaultInputType? params, int? index, String scope = BaseScopes.global, bool withoutConnections = false}) → KInstance - Return instance for given type
-
getAllByTypeString(
String scope, String type) → List< BaseKoreInstance> - Similar to all but with type provided
-
getAsync<
KInstance extends BaseKoreInstance> ({DefaultInputType? params, int? index, String scope = BaseScopes.global, bool withoutConnections = false}) → Future< KInstance> - Returns instance for given type
-
getByTypeString(
{required String type, DefaultInputType? params, int? index, String scope = BaseScopes.global, bool withoutConnections = false}) → BaseKoreInstance - Similar to get
-
getByTypeStringWithParams<
InputState> ({required String type, InputState? params, int? index, String scope = BaseScopes.global, bool withoutConnections = false}) → BaseKoreInstance - Similar to get
-
getByTypeStringWithParamsAsync<
InputState> ({required String type, InputState? params, int? index, String scope = BaseScopes.global, bool withoutConnections = false}) → Future< BaseKoreInstance> - Similar to get
-
getInstanceFromCache<
KInstance extends BaseKoreInstance> (String id, {dynamic params, int? index, String scopeId = BaseScopes.global, bool withoutConnections = false}) → KInstance -
getInstanceFromCacheAsync<
KInstance extends BaseKoreInstance, InputState> (String id, {dynamic params, int? index, String? scopeId, bool withoutConnections = false}) → Future< KInstance> -
getUnique<
KInstance extends BaseKoreInstance> ({DefaultInputType? params, bool withoutConnections = false}) → KInstance - Similar to get, but create new instance every time
-
getUniqueAsync<
KInstance extends BaseKoreInstance> ({bool withoutConnections = false}) → Future< KInstance> - Similar to get, but create new instance every time
-
getUniqueByTypeString(
String type, {DefaultInputType? params, bool withoutConnections = false}) → BaseKoreInstance - Similar to get, but create new instance every time
-
getUniqueByTypeStringWithParams<
InputState> ({required String type, InputState? params, bool withoutConnections = false, void beforeInitialize(dynamic)?}) → BaseKoreInstance - Similar to get, but create new instance every time
-
getUniqueByTypeStringWithParamsAsync<
InputState> ({required String type, InputState? params, bool withoutConnections = false, void beforeInitialize(dynamic)?}) → Future< BaseKoreInstance> - Similar to get, but create new instance every time
-
getUniqueWithParams<
KInstance extends BaseKoreInstance, InputState> ({InputState? params, bool withoutConnections = false}) → KInstance - Similar to get, but create new instance every time
-
getUniqueWithParamsAsync<
KInstance extends BaseKoreInstance, InputState> ({InputState? params, bool withoutConnections = false}) → Future< KInstance> - Similar to get, but create new instance every time
-
getWithParams<
KInstance extends BaseKoreInstance, InputState> ({InputState? params, int? index, String scope = BaseScopes.global, bool withoutConnections = false}) → KInstance - Return instance for given type
-
getWithParamsAsync<
KInstance extends BaseKoreInstance, InputState> ({InputState? params, int? index, String scope = BaseScopes.global, bool withoutConnections = false}) → Future< KInstance> - Return instance for given type
-
increaseReferencesInScope(
String scope, Type type, {int index = 0}) → void - Increases reference count in given scope for given type
-
mock<
KInstance extends BaseKoreInstance> ({KInstance? instance, KInstance builder()?}) → void - Adds mocked builder for given instance type or concrete instance
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
performCheckForCyclicDependencies(
String typeId, int? index) → void - Checks if object with type id is currently building and throws exception if so
-
printMap(
) → void - Utility method to print instances map
-
prune(
) → void - Method to remove instances that is no longer used
-
toString(
) → String -
A string representation of this object.
inherited
-
unregisterInstance<
T> ({String scope = BaseScopes.global, int? index}) → void - Unregisters instance in scope and resets object reference counter in scope
-
useAndDisposeInstance<
T extends BaseKoreInstance> (Future body(T)) → Future - Helper method to get unique instance and dispose it automatically after body is finished
-
useAndDisposeInstanceWithParams<
T extends BaseKoreInstance, Input> (Input? params, Future body(T)) → Future - Helper method to get unique instance and dispose it automatically after body is finished
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → InstanceCollection
-
no setter