saveModels<T extends BaseModel> method

FutureOr<void> saveModels<T extends BaseModel>(
  1. String database,
  2. Iterable<T> models
)

Saves the T models in database. models that do not have an existing id will have one automatically assigned to them. This function doesn't care if there is an already existing model or not. Existing models will just be overridden

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

Implementation

FutureOr<void> saveModels<T extends BaseModel>(
  String database,
  Iterable<T> models,
) async {
  await Future.wait(models.map((e) async => saveModel(database, e)));
}