FirebaseExtended / firestoreodm-flutter

BSD 3-Clause "New" or "Revised" License
36 stars 11 forks source link

Feature request - Add batch API #12

Closed lirantzairi closed 4 months ago

lirantzairi commented 8 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();