addAll method
Adds multiple items to the repository.
Implementation
@override
Future<Iterable<T>> addAll(Iterable<IdentifiedObject<T>> items) async {
try {
final batch = store.batch();
for (final item in items) {
final doc = store.doc(_normaliseToFullPath(item.id));
final json = RepositoryFirestore.typeConversionToFirebase.convert(
source: toFirestore(item.object),
);
batch.set(doc, json);
}
await batch.commit();
return items.map((e) => e.object).toList(growable: false);
} on firestore.FirebaseException catch (e) {
throw RepositoryException(message: 'Batch operation failed: ${e.message}');
}
}