RefHasPage class abstract

Reference with page scope Ref.

This can be extended with an extension to add a method to handle ScopedValue that stores a value per page.

For example, the state of the currently displayed tab should be stored on a page-by-page basis. Therefore, by extending this class to explicitly limit the scope of use, it is possible to specify how data is held in a way that is easy for developers to understand.

ページスコープのRefを持ったリファレンス。

これをextensionで拡張することでページごとに値を保存するScopedValueを扱うメソッドを追加することができます。

例えば、現在表示しているタブの状態などはページごとに保存されるべきものです。そのためこのクラスを拡張して利用されるスコープを明示的に限定することで開発者に分かりやすくデータの持ち方を指定することが可能です。

extension PageRefTabExtensions on RefHasPage {
  String useTab(
    String defaultTabId
  ) {
    return page.watch(() => ValueNotifier(defaultTabId));
  }
}
Implemented types
Implementers
Available Extensions
Annotations

Constructors

RefHasPage()

Properties

hashCode int
The hash code for this object.
no setterinherited
page PageScopedValueRef
Ref in the page scope.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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