Provider<T extends Object> 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})
Configures a Provider based on the arguments provided.
const
factory

Properties

deps List<Object>?
Optional; dependencies to inject and provide when invoking useFactory.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
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

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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