commit method

Future<void> commit()

Commits all of the writes in this batch as a single atomic unit. The future completes when the backend has applied them.

Implementation

Future<void> commit() async {
  _verifyNotCommitted();
  _committed = true;
  // An empty batch sends nothing, but still fails on a terminated instance.
  await _firestore.run<void>(
    (Datastore datastore) => _mutations.isEmpty
        ? Future<void>.value()
        : datastore.transactionClient.commit(_mutations),
  );
}