ValueProvider<T> class

Describes at compile-time using a constant value to represent a token.

It is recommended to use useValue with an OpaqueToken as token:

const animationDelay = const OpaqueToken<Duration>('animationDelay');

const ValueProvider(animationDelay, const Duration(seconds: 1));

NOTE: The AngularDart compiler has limited heuristics for supporting complex nested objects beyond simple literals, including collection literals like a List or Map where you might expect specific reified types. If you encounter problems it is recommended to use FactoryProvider instead.

Inheritance
Annotations
  • @optionalTypeArgs

Constructors

ValueProvider(Type type, T useValue, { bool multi })
const
factory
ValueProvider.forToken(OpaqueToken<T> token, T useValue, { bool multi })
const
factory

Properties

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