ScopedValueRef class abstract

Ref associated with the widget.

ウィジェットに関連するRef

Base class for References passed from ScopedWidget, etc.

This can be extended with an extension to add a method for handling ScopedValue.

In that case, use getScopedValue to generate and pass ScopedValue.

ScopedWidget等から渡されるReferenceのベースクラス。

これをextensionで拡張することでScopedValueを扱うメソッドを追加することができます。

その場合、getScopedValueScopedValueを生成して渡してください。

extension RefCacheExtensions on Ref {
  T cache<T>(
    T Function() callback, {
    List<Object> keys = const [],
  }) {
    return getState<T, _CacheValue<T>>(
      () => _CacheValue<T>(callback: callback, keys: keys),
      listen: false,
    );
  }
}
Implemented types
Available extensions
Annotations

Properties

context BuildContext
BuildContext of the associated widget.
final
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cache<T>(T callback(QueryScopedValueRef<Ref> ref), {List<Object> keys = const [], Object? name}) → T

Available on Ref, provided by the RefCacheExtensions extension

future<T>(FutureOr<T> callback(), {List<Object> keys = const [], Object? name}) FutureContext<T>

Available on Ref, provided by the RefFutureExtensions extension

getAlreadyExistsScopedValue<TResult, TScopedValue extends ScopedValue<TResult>>({Object? name, bool listen = false, bool recursive = true}) → TResult?
Obtains a TScopedValue already stored in ScopedValueContainer.
override
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 TResult while creating, saving, and managing the state of TScopedValue.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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 passing query.
toString() String
A string representation of this object.
override
watch<T extends Listenable?>(T callback(QueryScopedValueRef<Ref> ref), {List<Object> keys = const [], Object? name, bool disposal = true, bool autoDisposeWhenUnreferenced = false}) → T

Available on Ref, provided by the RefWatchExtensions extension

Operators

operator ==(Object other) bool
The equality operator.
override