0
0
Fluttermobile~10 mins

Cloud Firestore CRUD in Flutter - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Firestore package in Flutter.

Flutter
import 'package:cloud_firestore/[1].dart';
Drag options to blanks, or click blank then click option'
Afirestore
Bfirebase
Cfirestore_core
Dfirestore_flutter
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'firebase' instead of 'firestore' in the import path.
Trying to import 'firestore_flutter' which does not exist.
2fill in blank
medium

Complete the code to get a Firestore instance in Flutter.

Flutter
final FirebaseFirestore firestore = FirebaseFirestore.[1];
Drag options to blanks, or click blank then click option'
Ainitialize
Binstance
CgetInstance
Dcreate
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'getInstance()' which is not defined in Flutter Firestore.
Trying to call 'initialize()' or 'create()' which do not exist.
3fill in blank
hard

Fix the error in the code to add a new document to the 'users' collection.

Flutter
await firestore.collection('users').[1]({'name': 'Alice', 'age': 25});
Drag options to blanks, or click blank then click option'
Aupdate
Binsert
Cset
Dadd
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'update' which requires an existing document.
Using 'set' without specifying a document ID.
Using 'insert' which is not a Firestore method.
4fill in blank
hard

Fill both blanks to update the 'age' field of a user document with ID 'user123'.

Flutter
await firestore.collection('users').doc([1]).[2]({'age': 30});
Drag options to blanks, or click blank then click option'
A'user123'
Bupdate
Cset
D'user456'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'set' which overwrites the whole document.
Using wrong document ID like 'user456'.
5fill in blank
hard

Fill all three blanks to delete a document with ID 'doc789' from the 'items' collection.

Flutter
await firestore.collection([1]).doc([2]).[3]();
Drag options to blanks, or click blank then click option'
A'items'
B'doc789'
Cdelete
Dremove
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'remove' which is not a Firestore method.
Using wrong collection or document IDs.