Provider<T> class

A Provider provides a value on request.

If a provider implements Listenable, it will be listened to by the Provide widget to rebuild on change. Other than the built in providers, one can implement Provider to provide caching or linkages.

When a Provider is instantiated within a providers.provide call, the type can be inferred and therefore the type can be ommited, but otherwise, T is required.

Provider should be implemented and not extended.

Implementers

Constructors

Provider.function(ProviderFunction<T> function)
Creates a provider which will initialize using the ProviderFunction the first time the value is requested. [...]
factory
Provider.stream(Stream<T> stream, {T initialValue})
Creates a provider that listens to a stream and caches the last received value of the stream. [...]
factory
Provider.value(T value)
Creates a provider with the value provided to it.
factory
Provider.withFactory(ProviderFunction<T> function)
Creates a provider that provides a new value for each requestor of the value.
factory

Properties

type → Type
The type that is provided by the provider.
read-only
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

dispose() → Future<void>
Disposes of any resources or listeners held on by the provider.
get(BuildContext context) → T
Returns the value provided by the provider. [...]
stream(BuildContext context) → Stream<T>
Returns a stream of changes to the underlying value.
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