FirebaseExtended / firestoreodm-flutter

BSD 3-Clause "New" or "Revised" License
33 stars 9 forks source link

Feature request - Add batch API #12

Closed lirantzairi closed 2 weeks ago

lirantzairi commented 4 months ago

Just like we have the transaction API, it'll be useful to also have a batch API in the odm that works in a similar way, e.g:

// Today's transaction API:
await FirebaseFirestore.instance.runTransaction((transaction) async {
  collectionRef.doc('123').transactionUpdate(transaction, title: 'New Title');
});

// Suggested batch API:
final batch = FirebaseFirestore.instance.batch();
collectionRef.doc('123').batchUpdate(batch, title: 'New Title');
await batch.commit();