Add a new item to Firestore (Firebase) in Flutter

1. Create a new dart file add_recipe.dart

2. Create a StatefulWidget inside this file

3. Add a Scaffold with an AppBar()

4. Add a form to the Scaffold’s body

5. Inside Recipes widget add a floating action button to load AddRecipe widget

6. Inside AddRecipe: get the reference to the Recipe collection

7. Create function addRecipe()

Using the add function of the CollectionReference add the new data to Firebase.

8. Call the above function on clicking the submit button

Leave a Reply

Your email address will not be published. Required fields are marked *