Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to initialize Firebase in a Flutter app.
Flutter
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.[1]();
runApp(MyApp());
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method name that does not exist in Firebase.
Forgetting to call ensureInitialized before Firebase initialization.
✗ Incorrect
The method initializeApp() is used to initialize Firebase before running the app.
2fill in blank
mediumComplete the code to sign in a user with email and password.
Flutter
final userCredential = await FirebaseAuth.instance.[1]('user@example.com', 'password123');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method that does not exist in FirebaseAuth.
Confusing sign in with registration methods.
✗ Incorrect
The method signInWithEmailAndPassword signs in a user using email and password.
3fill in blank
hardFix the error in the code to sign out the current user.
Flutter
await FirebaseAuth.instance.[1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like 'logOutUser' or 'logout'.
Using signIn instead of signOut.
✗ Incorrect
The correct method to sign out a user is signOut().
4fill in blank
hardFill both blanks to create a new user with email and password.
Flutter
final userCredential = await FirebaseAuth.instance.[1]('[2]', 'mypassword');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using signIn method instead of createUser.
Using an invalid email string.
✗ Incorrect
Use createUserWithEmailAndPassword to register a new user, and provide a valid email like newuser@example.com.
5fill in blank
hardFill all three blanks to send a password reset email.
Flutter
await FirebaseAuth.[1].sendPasswordResetEmail(email: '[2]'); print('[3]');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect FirebaseAuth instance accessor.
Forgetting to provide the email parameter.
Not printing a confirmation message.
✗ Incorrect
Use instance to access FirebaseAuth instance, provide the user's email, and print a confirmation message.