0
0
Fluttermobile~10 mins

Why Firebase provides backend services in Flutter - Test Your Understanding

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.

Flutter
await Firebase.[1]();
Drag options to blanks, or click blank then click option'
AstartApp
BinitializeApp
CrunApp
DlaunchApp
Attempts:
3 left
💡 Hint
Common Mistakes
Using runApp instead of initializeApp
Calling startApp which does not exist
2fill in blank
medium

Complete the code to add a document to Firestore database.

Flutter
FirebaseFirestore.instance.collection('users').[1]({'name': 'Anna'});
Drag options to blanks, or click blank then click option'
Aadd
Bget
Cupdate
Ddelete
Attempts:
3 left
💡 Hint
Common Mistakes
Using get which reads data
Using update which modifies existing data
3fill in blank
hard

Fix the error in the code to listen for authentication state changes.

Flutter
FirebaseAuth.instance.authStateChanges().[1]((User? user) {
  if (user == null) {
    print('User signed out');
  } else {
    print('User signed in');
  }
});
Drag options to blanks, or click blank then click option'
AonChange
Bsubscribe
Clisten
Dwatch
Attempts:
3 left
💡 Hint
Common Mistakes
Using subscribe which is not a Dart Stream method
Using onChange which does not exist
4fill in blank
hard

Fill both blanks to create a map of user IDs to their email addresses from a list.

Flutter
var userMap = {user.[1]: user.[2] for user in users};
Drag options to blanks, or click blank then click option'
Auid
Bemail
Cname
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Using name or id which are not standard Firebase user properties
5fill in blank
hard

Fill all three blanks to filter and map Firestore documents with age over 18.

Flutter
var adults = {doc.[1]: doc.data()[[2]] for doc in snapshot.docs if doc.data()[[3]] > 18};
Drag options to blanks, or click blank then click option'
Aid
B'age'
C'name'
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up field names or using data instead of id for keys