multiFetch method

Future<List<T>> multiFetch({
  1. required Iterable<DocumentReference<Object?>> refs,
  2. Source source = Source.serverAndCache,
})

Same as RepositoryAddon.multiTransform but will return a Future with latest values in the DB using the given refs.

Implementation

Future<List<T>> multiFetch({
  required Iterable<DocumentReference> refs,
  Source source = Source.serverAndCache,
}) async {
  final futures = refs.map((ref) async => await tryFetch(
        ref: ref,
        source: source,
      ));
  return (await Future.wait(futures))
      .where((i) => i != null)
      .whereType<T>()
      .toList(growable: false);
}