Provider<T> class

Use a Provider to implement a stateless provider. Useful for dependency injection. Often used with overrideWithValue during initialization of the app.

Set describeState to customize the description of the state. See BaseNotifier.describeState.

Set debugLabel to customize the debug label of the provider.

Constructors

Provider(T _builder(Ref ref), {String describeState(T state)?, String? debugLabel, bool debugVisibleInGraph = true})

Properties

customDebugLabel String?
A custom label used by debug tools.
finalinherited
debugLabel String
A label to be used in debug messages and by the RefenaTracingPage.
no setterinherited
debugVisibleInGraph bool
Set this flag to false to hide the provider from the RefenaGraphPage. By default, all providers are visible in the graph. However, some providers add unnecessary noise.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
provider → BaseProvider<ImmutableNotifier<T>, T>
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createState(ProxyRef ref) ImmutableNotifier<T>
getActualProvider(BaseNotifier<Object?> notifier) Provider<T>
inherited
getSelectedState(ImmutableNotifier<T> notifier, T state) → T
The default behavior to return the whole state when using ref.watch(provider).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
overrideWithBuilder(T builder(Ref ref)) ProviderOverride<ImmutableNotifier<T>, T>
Overrides the state of a provider with a predefined value.
overrideWithFuture(Future<T> builder(Ref ref)) ProviderOverride<ImmutableNotifier<T>, T>
Overrides the state of a provider with a predefined value. Here, you can use a future to build the state.
overrideWithValue(T value) ProviderOverride<ImmutableNotifier<T>, T>
Overrides the state of a provider with a predefined value.
select<R>(R selector(T state)) → SelectedWatchable<ImmutableNotifier<T>, T, R>
Used for ref.watch(provider.select(...)). Select a part of the state.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
Subclasses should not override this method. It is used internally by RefenaContainer to map a provider to a state.
inherited