lc_firestore_batch 0.1.3
lc_firestore_batch: ^0.1.3 copied to clipboard
A util for firebase batch op
What's for this #
This is a util for firebase batch write.
How to use #
// 📦 Package imports:
import 'package:cloud_firestore/cloud_firestore.dart';
// 🌎 Project imports:
import 'package:lc_firestore_batch/lc_firestore_batch.dart';
void main() async {
// optional
setupLcFirebaseBatch(
setting: LcFirebaseBatchSetting(
getAuthedUserId: () => 'test.uid',
),
);
final batch = LcFirestoreBatch();
batch.create(
collectionPath: 'test',
currentChanges: {'date': LcFieldValue.serverTimestamp()},
docId: '1',
);
batch.update(
collectionPath: 'test',
docId: '1',
currentChanges: {'name': 'test'},
);
batch.delete(collectionPath: 'test', docId: '1');
await batch.commit();
}