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': FieldValue.serverTimestamp()},
    docId: '1',
  );
  batch.update(
    collectionPath: 'test',
    docId: '1',
    currentChanges: {'name': 'test'},
  );
  batch.delete(collectionPath: 'test', docId: '1');

  await batch.commit();
}

Libraries

cloud_firestore
firebase_auth
firebase_core
lc_firestore_batch
A util for firebase batch op