loadCollection method
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);
}
if (networkDelay != null) {
await Future.delayed(networkDelay!);
}
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)))
: {};
}