RefHasApp class abstract

Reference with ScopedValueRef in the application scope.

This can be extended with an extension to add a method to handle ScopedValue that stores the value in the application.

For example, data loaded from a remote server should be stored in the application scope since it is used between pages. Therefore, by extending this class to explicitly limit the scope in which it is used, it is possible to specify how data is held in a way that is easy for developers to understand.

アプリケーションスコープのRefを持ったリファレンス。

これをextensionで拡張することでアプリケーションに値を保存するScopedValueを扱うメソッドを追加することができます。

例えば、リモートサーバーからロードするデータはページ間で利用されるものなのでアプリケーションスコープで保存されるべきものです。そのためこのクラスを拡張して利用されるスコープを明示的に限定することで開発者に分かりやすくデータの持ち方を指定することが可能です。

extension AppRefRepositoryExtensions on RefHasApp {
  T repository<T extends ChangeNotifier>(
    T Function() callback,
  ) {
    return app.watch(callback);
  }
}
Implemented types
Implementers
Available Extensions
Annotations

Constructors

RefHasApp()

Properties

app AppScopedValueRef
Ref in the application scope.
no setter
hashCode int
The hash code for this object.
no setterinherited
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