0
0
Firebasecloud~10 mins

Firebase with 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 initialize Firebase in a Flutter app.

Firebase
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase[1]();
  runApp(MyApp());
}
Drag options to blanks, or click blank then click option'
AinitializeApp
BstartApp
CinitFirebase
DsetupFirebase
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like startApp or setupFirebase.
Forgetting to call ensureInitialized before initializing Firebase.
2fill in blank
medium

Complete the code to get an instance of Firestore in Flutter.

Firebase
final FirebaseFirestore firestore = FirebaseFirestore.[1];
Drag options to blanks, or click blank then click option'
AfirestoreInstance
BgetInstance
CgetFirestore
Dinstance
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to call getInstance() which does not exist in Flutter Firestore.
Using incorrect method names like getFirestore.
3fill in blank
hard

Fix the error in the code to add a document to Firestore collection.

Firebase
await firestore.collection('users').[1]({'name': 'Alice', 'age': 25});
Drag options to blanks, or click blank then click option'
Aadd
BaddDocument
Cinsert
Dcreate
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like addDocument or insert.
Confusing with create which is not a Firestore method.
4fill in blank
hard

Fill both blanks to read a document from Firestore and print its data.

Firebase
DocumentSnapshot snapshot = await firestore.collection('users').[1]('user123').[2]();
print(snapshot.data());
Drag options to blanks, or click blank then click option'
Adoc
Bget
Cdocument
Dfetch
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'document' instead of 'doc' which is deprecated.
Using 'fetch' which is not a Firestore method.
5fill in blank
hard

Fill all three blanks to update a Firestore document with new data.

Firebase
await firestore.collection('users').[1]('user123').[2]([3]);
Drag options to blanks, or click blank then click option'
Adoc
Bupdate
C{'age': 26}
Dset
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'set' instead of 'update' which overwrites the whole document.
Passing data as a string instead of a map.