PageOrWidgetScopedValueRef class abstract
ScopedValueRef of the Page or Widget (whose state can be monitored).
This can be extended with an extension to add a method to handle ScopedValue that stores a value per page.
PageもしくはWidget(状態を監視可能なもの)のScopedValueRef。
これをextensionで拡張することでページごとに値を保存するScopedValueを扱うメソッドを追加することができます。
extension RefWatchExtensions on PageOrWidgetScopedValueRef {
T watch<T extends Listenable>(
T Function() callback, {
List<Object> keys = const [],
}) {
return getScopedValue<T, _WatchValue<T>>(
() => _WatchValue<T>(callback: callback, keys: keys),
listen: true,
);
}
}
- Implemented types
- Available extensions
- PageOrWidgetScopedValueRefCacheExtensions
- PageOrWidgetScopedValueRefFutureExtensions
- PageOrWidgetScopedValueRefOnExtensions
- PageOrWidgetScopedValueRefPeriodicExtensions
- PageOrWidgetScopedValueRefRefreshExtensions
- PageOrWidgetScopedValueRefScheduleExtensions
- PageOrWidgetScopedValueRefTimerExtensions
- PageOrWidgetScopedValueRefWatchExtensions
- PageScopedValueRefAncestorExtensions
- RefQueryExtensions
- Annotations
Constructors
Properties
- context → BuildContext
-
BuildContext of the associated widget.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cache<
T> (T callback(QueryScopedValueRef< PageOrWidgetScopedValueRef> ref), {List<Object> keys = const [], Object? name}) → T -
Available on PageOrWidgetScopedValueRef, provided by the PageOrWidgetScopedValueRefCacheExtensions extension
Caches and stores the value returned bycallback. -
fetch<
T> ([Object? name]) → T -
Available on PageOrWidgetScopedValueRef, provided by the PageScopedValueRefAncestorExtensions extension
This is used to retrieve a ScopedValue already registered in watch or cache with the widget below it, etc. -
future<
T> (FutureOr< T> callback(), {List<Object> keys = const [], Object? name}) → FutureContext<T> -
Available on PageOrWidgetScopedValueRef, provided by the PageOrWidgetScopedValueRefFutureExtensions extension
You can pass acallbackthat returns Future and wait for it. -
getAlreadyExistsScopedValue<
TResult, TScopedValue extends ScopedValue< (TResult> >{Object? name, bool listen = false, bool recursive = true}) → TResult? -
Obtains a
TScopedValuealready stored in ScopedValueContainer.inherited -
getScopedValue<
TResult, TScopedValue extends ScopedValue< (TResult> >TScopedValue provider(Ref ref), {void onInit(ScopedValueState< TResult, TScopedValue> state)?, void onUpdate(ScopedValueState<TResult, TScopedValue> state)?, bool listen = false, Object? name}) → TResult -
A method that returns the value of
TResultwhile creating, saving, and managing the state ofTScopedValue.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
on(
{FutureOr< void> initOrUpdate()?, VoidCallback? disposed, VoidCallback? appResumed, VoidCallback? appInactive, VoidCallback? appPaused, VoidCallback? appDetached, VoidCallback? appHidden, List<Object> keys = const []}) → OnContext -
Available on PageOrWidgetScopedValueRef, provided by the PageOrWidgetScopedValueRefOnExtensions extension
Processing in the lifecycle. -
periodic(
FutureOr< void> callback(DateTime currentTime, DateTime startTime), {required Duration duration, Object? name}) → Timer -
Available on PageOrWidgetScopedValueRef, provided by the PageOrWidgetScopedValueRefPeriodicExtensions extension
Periodic processing. -
query<
T, TRef extends Ref> (ScopedQueryBase< T, TRef> query, {bool? autoDisposeWhenUnreferenced}) → T -
Available on Ref, provided by the RefQueryExtensions extension
It is possible to manage the status by passingquery. -
refresh(
) → void -
Available on PageOrWidgetScopedValueRef, provided by the PageOrWidgetScopedValueRefRefreshExtensions extension
When executed, it redraws the associated widget. -
schedule(
FutureOr< void> callback(DateTime currentTime, DateTime startTime), {required DateTime dateTime, Object? name}) → ScheduleContext -
Available on PageOrWidgetScopedValueRef, provided by the PageOrWidgetScopedValueRefScheduleExtensions extension
callbackexecuted ondateTime. -
timer(
FutureOr< void> callback(DateTime currentTime, DateTime startTime), {required Duration duration, Object? name}) → Timer? -
Available on PageOrWidgetScopedValueRef, provided by the PageOrWidgetScopedValueRefTimerExtensions extension
callbackto be executed again afterduration. -
toString(
) → String -
A string representation of this object.
inherited
-
watch<
T extends Listenable?> (T callback(QueryScopedValueRef< PageOrWidgetScopedValueRef> ref), {List<Object> keys = const [], Object? name, bool disposal = true}) → T -
Available on PageOrWidgetScopedValueRef, provided by the PageOrWidgetScopedValueRefWatchExtensions extension
You can monitor it by passing acallbackthat returns a ChangeNotifier.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited