I built a multi-tab Flutter Web registration form (Clients and Workers) that submits data to Firebase Firestore using the .add() method.
It was working fine for a few days, but now I'm getting this error in the console:
FirebaseError: FirebaseError: [code=invalid-argument]: Request is missing required field: write.operations
Here’s how I’m submitting data:
await FirebaseFirestore.instance.collection("registrations").add({
"fullName": fullNameController.text.trim(),
"email": emailController.text.trim(),
// more fields...
});
What I Tried:
I used
FirebaseFirestore.instance.collection("registrations").add({...})to submit the form data.Verified that all required fields have valid values before calling
.add().Ensured Firebase security rules are not blocking the request (allow read, write: if true;).
Simplified the data to just one key-value pair to check if it was due to large data — still failed.
Tested in Flutter Web (Chrome) — fails with the 400 invalid-argument error.
Tested the same code in Flutter Android emulator — works fine without error.
Also rechecked if any of the text controllers were null or empty.
What I Expected:
The
.add()call should successfully create a new document in the registrations Firestore collection.The Firestore backend should return the new document ID as usual.
No errors should appear in the browser console or terminal.