ViewProvider<T> class

The ViewProvider is the only provider that can watch other providers. Its builder is similar to a normal Provider. A common use case is to define a view model that depends on many providers. Don't worry about the ref, you can use it freely inside any function. The ref will never become invalid.

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

Set debugLabel to customize the debug label of the provider.

Constructors

ViewProvider(T _builder(WatchableRef ref), {ProviderChangedCallback<T>? onChanged, 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<ViewProviderNotifier<T>, T>
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createState(Ref ref) ViewProviderNotifier<T>
getActualProvider(BaseNotifier<Object?> notifier) ViewProvider<T>
inherited
getSelectedState(ViewProviderNotifier<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(WatchableRef)) ProviderOverride<ViewProviderNotifier<T>, T>
Overrides with a predefined value.
select<R>(R selector(T state)) → SelectedWatchable<ViewProviderNotifier<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

Static Methods

family<T, P>(ViewFamilyBuilder<T, P> builder, {String describeState(T state)?, String? debugLabel, bool debugVisibleInGraph = true}) ViewFamilyProvider<T, P>
A shorthand for ViewFamilyProvider.