load method

Future<CollectionBase<TModel>> load()

Reads the collection corresponding to modelQuery.

The return value is the CollectionBase itself, 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に対応したコレクションの読込を行います。

戻り値はCollectionBaseそのものが返され、そのまま読込済みのデータの利用が可能になります。

一度読み込んだコンテンツに対しては、新しい読込は行われません。そのためWidgetbuildメソッド内など何度でも読み出されるメソッド内でも利用可能です。

再読み込みを行いたい場合はreloadメソッドを利用してください。

Implementation

Future<CollectionBase<TModel>> load() async {
  if (loaded) {
    return this;
  }
  if (_loadCompleter != null) {
    return loading!;
  }
  await _enqueueInternalTransaction(() async {
    if (loaded) {
      return;
    }
    await _load();
  });
  return this;
}