Provider<T> class

Describes at compile-time how an Injector should be configured.

Loosely put, a Provider is a binding between a token (commonly either a Type or OpaqueToken), and an implementation that is provided either by invoking a constructor, a factory function, or referring to a literal value.

NOTE: The fields in this class are soft deprecated, and should not be inspected or accessed at runtime. Future implementations may optimize by removing them entirely.

Implementers
Annotations
  • @optionalTypeArgs

Constructors

Provider(Object token, { Type useClass, Object useValue, Object useExisting, Function useFactory, List<Object> deps, bool multi })
Configures a Provider based on the arguments provided. [...]
const
factory

Properties

deps → List<Object>
Optional; dependencies to inject and provide when invoking useFactory.
final
multi → bool
Whether to treat this provider as a "multi" provider (multiple values). [...]
final
token → Object
Key used for injection, commonly a Type or OpaqueToken.
final
useClass → Type
Class whose constructor should be invoked when token is injected. [...]
final
useExisting → Object
An existing token to redirect to when token is injected. [...]
final
useFactory → Function
A factory function to invoke when token is injected. [...]
final
useValue → Object
Constant value to use when token is injected. [...]
final
hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) → bool
The equality operator. [...]
inherited