findModels<T extends BaseModel> method

FutureOr<Iterable<T>> findModels<T extends BaseModel>(
  1. String database,
  2. Iterable<String> keys
)

Finds all the models in the given database that have the given keys

The default implementation simply calls findModel multiple times. A concrete implementation with a more efficient way of doing this should override this function.

Implementation

FutureOr<Iterable<T>> findModels<T extends BaseModel>(
  String database,
  Iterable<String> keys,
) async =>
    (await Future.wait(keys.map((e) async => findModel<T>(database, e))))
        .where((element) => element != null)
        .map((e) => e!)
        .toList();