reload method
Reload the document corresponding to modelQuery.
The return value is a T
object, and the loaded data is available as is.
Unlike the load method, this method performs a new load each time it is executed. Therefore, do not use this method in a method that is read repeatedly, such as in the build
method of a widget
.
modelQueryに対応したドキュメントの再読込を行います。
戻り値はT
オブジェクトが返され、そのまま読込済みのデータの利用が可能になります。
loadメソッドとは違い実行されるたびに新しい読込を行います。そのためWidget
のbuild
メソッド内など何度でも読み出されるメソッド内では利用しないでください。
Implementation
Future<T?> reload() async {
await _enqueueInternalTransaction(() async {
_reloadingCompleter = Completer();
try {
_loaded = false;
await _load();
} catch (e) {
_reloadingCompleter?.completeError(e);
_reloadingCompleter = null;
rethrow;
} finally {
_reloadingCompleter?.complete(value);
_reloadingCompleter = null;
}
});
return value;
}