loadCollection method

  1. @override
Future<Map<String, DynamicMap>> loadCollection(
  1. ModelAdapterCollectionQuery query
)
override

Pass query to the platform set by the adapter to retrieve the collection.

All return values ​​will be Map<String, DynamicMap>. String contains the ID (not the path) of each document.

アダプターで設定されたプラットフォームにqueryを渡してコレクションを取得します。

戻り値はすべてMap<String, DynamicMap>になります。Stringには各ドキュメントのID(パスではない)が入ります。

Implementation

@override
Future<Map<String, DynamicMap>> loadCollection(
  ModelAdapterCollectionQuery query,
) async {
  _assert();
  if (validator != null) {
    await validator!.onPreloadCollection(query);
  }
  final data = await database.loadCollection(query, prefix: prefix);
  if (validator != null) {
    await validator!.onPostloadCollection(query, data);
  }
  return data != null
      ? data.map((key, value) => MapEntry(key, Map.from(value)))
      : {};
}