This type of Ref available in the build method of rebuildable providers.
In Flutter, it is available as BuildContext.ref
or with the Refena
mixin.
Similarly to the original Ref, a WatchableRef lives as long as the RefenaContainer lives. If the Rebuildable (e.g. Widget) is disposed, then WatchableRef.watch has no effect except returning the current state.
- Implemented types
- Available Extensions
Constructors
Properties
- container → RefenaContainer
-
Returns the backing container.
The container exposes more advanced methods for edge cases.
no setterinherited
- debugOwnerLabel → String
-
Returns the owner of this Ref.
Usually, this is a notifier or a widget.
Used by Ref.redux to log the origin of the action.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
accessor<
R> (BaseWatchable< BaseNotifier, dynamic, R> provider) → StateAccessor<R> -
Similar to Ref.read, but instead of returning the state right away,
it returns a StateAccessor to get the state later.
inherited
-
dispose<
N extends BaseNotifier< (T> , T>BaseProvider< N, T> provider) → void -
Disposes a
provider
. Be aware that streams (ref.stream) are closed also. You may call this method in the dispose method of a stateful widget. Calling this method multiple times has no effect. Note: Theprovider
will be initialized again on next access.inherited -
disposeFamilyParam<
N extends FamilyNotifier< (dynamic, P, dynamic> , P>BaseProvider< N, dynamic> provider, P param) → void -
Disposes the
param
of a familyprovider
. While the ordinary dispose method disposes the whole provider, this method only disposes theparam
. Calling this method multiple times has no effect.inherited -
future<
N extends GetFutureNotifier< (T> , T>ProviderAccessor< BaseProvider< provider) → Future<N, AsyncValue< , N, AsyncValue<T> >T> >T> -
Get the Future of an AsyncNotifierProvider, FutureProvider or
StreamProvider.
inherited
-
message(
String message) → void -
Emits a message to the observer.
This might be handy if you use
RefenaTracingPage
.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifier<
N extends BaseNotifier< (T> , T>NotifyableProvider< N, T> provider) → N -
Get the notifier of a provider.
inherited
-
read<
N extends BaseNotifier< (T> , T, R>BaseWatchable< N, T, R> watchable) → R -
Get the current value of a provider without listening to changes.
inherited
-
rebuild<
N extends RebuildableNotifier< (T, R> , T, R>RebuildableProvider< N, T, R> provider) → R -
Rebuilds a rebuildable provider (e.g. ViewProvider, FutureProvider)
and returns the result of the builder function.
inherited
-
redux<
N extends ReduxNotifier< (T> , T>ReduxProvider< N, T> provider) → Dispatcher<N, T> -
Get a proxy class to dispatch actions to a ReduxNotifier.
inherited
-
stream<
N extends BaseNotifier< (T> , T>ProviderAccessor< BaseProvider< provider) → Stream<N, T> , N, T>NotifierEvent< T> > -
Listen for changes to a provider.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
watch<
N extends BaseNotifier< (T> , T, R>BaseWatchable< N, T, R> watchable, {ListenerCallback<T> ? listener, bool rebuildWhen(T prev, T next)?}) → R - Get the current value of a provider and listen to changes. The listener will be disposed automatically when the widget is disposed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited