flutterfire
flutterfire copied to clipboard
[📚] [cloud_firestore_odm] Document how to use transaction in the update method
If I want to use transactionUpdate()
method, I need to provide a Transaction
object, but there is no documentation on how to create this object. For example, this code doesn't compile:
usersRef
.doc('foo_id')
.transactionUpdate(
transaction, // How to create this object?
name: 'John',
);
I can create a Transaction
object, using
var transaction = FirebaseFirestore.instance.runTransaction((txn) async {
return txn;
});
but using this object doesn't work in the first code. Here's the question on StackOverflow.