InjectorRegister class abstract interface

Interface for registering dependencies in a module.

Provides methods for adding different types of dependencies:

  • Regular dependencies (created new each time)
  • Singletons (created once and reused)
  • Lazy singletons (created on first use)
  • Instances (pre-created objects)
Implementers

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

add<T>(Function constructor, {String? key}) → void
Adds a dependency that will be created new each time it's requested.
addInstance<T>(T instance, {String? key}) → void
Adds a pre-created instance as a dependency.
addLazySingleton<T>(Function constructor, {String? key}) → void
Adds a lazy singleton that will be created on first use and then reused.
addSingleton<T>(Function constructor, {String? key}) → void
Adds a singleton dependency that will be created once and reused.
commit() → void
Commits all registered dependencies, making them available for use.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
replace<T>(T instance, {String? key}) → void
Replaces an existing dependency with a new instance.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited