dime_flutter library


Base Dime module for providing types and InjectFactory for types.
Closable class that must implement close method.
Creator based InjectFactory that creates new instance on every injection.
Singleton InjectFactory for a T type. It wil create an object using Creator method and store as singleton for future injections.
Provider of the current Dime Scope. It will store in tree of widgets the scope opened. and with scopeOf will provide that scope
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.
Wraps a child with Dime scope implementation. Also cleans up the scope on dispose
InjectFactory abstract class that provides a instance from a create method
InjectTagFactory abstract class with a tag support
InjectFactory that stores singleton instances per tag.
Injector factory that stores and re-shares the same instance of the T object.
Single instance factory where instance created is given at constructor.
InjectFactory that stores singleton map per each tag of a given type T.


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


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.
dimeGetOrNull<T>({String? tag}) → T?
Fetches a value and returns based on T type and optional instance 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.


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

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