0

I have been searching for a solution to change a couple of things in flutterflow when it comes to flutterfire authentication errors. 1- to control the error msg displayed in the snack bar. 2- changing the the grey background and white text design of the snack bar.

I can't find a solution that works! The custom code below is doing nothing.

I am new to flutter and flutterflow is there is something I missed?

Hopefully someone can help !



import 'package:firebase_auth/firebase_auth.dart';

Future<String> authFlutterFire(
  String emailAddress,
  String password,
  String messageInvalidEmail,
  String messageWrongPassword,
  String messageUserNotFound,
) async {
  String returnAuth = "valid";
  try {
    await FirebaseAuth.instance
        .signInWithEmailAndPassword(email: emailAddress, password: password);
  } on FirebaseAuthException catch (e) {
    // POSSIBLE ERRORS
    //
    // invalid-email
    // wrong-password
    // user-not-found
    //
    switch (e.code) {
      case 'invalid-email':
        returnAuth = messageInvalidEmail;
        break;
      case 'wrong-password':
        returnAuth = messageWrongPassword;
        break;
      case 'user-not-found':
        returnAuth = messageUserNotFound;
        break;
    }
  }
  return returnAuth;
}

0 Answers0