load method
Reads documents corresponding to modelQuery.
The return value is a T
object, and the loaded data is available as is.
Once content is loaded, no new loading is performed. Therefore, it can be used in a method that is read any number of times, such as in the build
method of a widget
.
If you wish to reload the file, use the reload method.
modelQueryに対応したドキュメントの読込を行います。
戻り値はT
オブジェクトが返され、そのまま読込済みのデータの利用が可能になります。
一度読み込んだコンテンツに対しては、新しい読込は行われません。そのためWidget
のbuild
メソッド内など何度でも読み出されるメソッド内でも利用可能です。
再読み込みを行いたい場合はreloadメソッドを利用してください。
Implementation
Future<T?> load() async {
if (loaded) {
return value;
}
if (_loadCompleter != null) {
return loading!;
}
await _enqueueInternalTransaction(() async {
if (loaded) {
return;
}
await _load();
});
return value;
}