dime library

Support for doing something awesome.

More dartdocs go here.

Classes

BaseDimeModule
Base Dime module for providing types and InjectFactory for types.
Closable
Closable class that must implement close method.
CreatorInjectFactory<T>
Creator based InjectFactory that creates new instance on every injection.
CreatorSingleInjectFactory<T>
Singleton InjectFactory for a T type. It wil create an object using Creator method and store as singleton for future injections.
DimeScope
Dime Scope, will keep instances and modules for this scope Provides methods to install or uninstall Modules installModule/uninstallModule Provides methods to add/remove factories with Scope's default module.
InjectFactory<T>
InjectFactory abstract class that provides a instance from a create method
InjectTagFactory<T>
InjectTagFactory abstract class with a tag support
SingleByTagInstanceFactory<T>
InjectFactory that stores singleton instances per tag.
SingleInjectFactory<T>
Injector factory that stores and re-shares the same instance of the T object.
SingleInstanceFactory<T>
Single instance factory where instance created is given at constructor.
TaggedSingletonInjectFactory<T>
InjectFactory that stores singleton map per each tag of a given type T.

Properties

dimeRootScope DimeScope
Returns Dime root scope - top level scope for the Isolate.
no setter

Functions

dimeAddScope(DimeScope scope) → void
Adds child scope to this scope.
dimeClose() → void
Closes Dime global scope and its child scopes.
dimeCloseScope({String? name, DimeScope? scope}) → void
Closes scope by name or scope
dimeGet<T>({String? tag}) → T
Fetches a value and returns based on T type and optional instance identifier tag.
dimeGetAsync<T>({String? tag}) FutureOr<T>
Fetches a Future of the type T with optional tag identifier tag.
dimeGetScope(String name) DimeScope?
Gets the scope from root Scope by name. Will return null if no scope found.
dimeGetWithTag<T>(String tag) → T
Fetches a value and returns it base on T type and instance identifier tag.
dimeInstall(BaseDimeModule module, {bool override = false}) → void
Installs module to the global scope of Dime.
dimeOpenScope(String name) DimeScope
Opens a scope by name, will return scope if was already created under that name will return the created scope
dimeReset() → void
Resets global scope, clears all child scopes and modules.
dimeUninstall(BaseDimeModule module) → void
Uninstalls module to global scope of Dime.

Typedefs

Creator<T> = T Function(String? tag)
Typed type to create a instance with a tag definition provided. This type is used in generative InjectFactory

Exceptions / Errors

DimeException
Dime Exception is special exception for Dime related errors. Easier to find DI errors to fix with in logs.