Complete the code to initialize Firebase in a Flutter app.
await Firebase.[1]();Firebase apps start by calling initializeApp() to set up backend services.
Complete the code to add a document to Firestore database.
FirebaseFirestore.instance.collection('users').[1]({'name': 'Anna'});
The add() method adds a new document to a Firestore collection.
Fix the error in the code to listen for authentication state changes.
FirebaseAuth.instance.authStateChanges().[1]((User? user) { if (user == null) { print('User signed out'); } else { print('User signed in'); } });
The listen() method subscribes to stream events like auth state changes.
Fill both blanks to create a map of user IDs to their email addresses from a list.
var userMap = {user.[1]: user.[2] for user in users};Each user object has a unique ID as uid and an email as email.
Fill all three blanks to filter and map Firestore documents with age over 18.
var adults = {doc.[1]: doc.data()[[2]] for doc in snapshot.docs if doc.data()[[3]] > 18};Use id for document ID, 'name' for mapping, and filter by 'age' field.
