2

I am using the official firebase-ui example from here: https://github.com/firebase/flutterfire/tree/master/packages/firebase_ui_auth/example

When my cloud functions return an error, the error is shown in the UI explicitly: Error message

Instead, I want to modify the message to be more user friendly based on the error that I get. Unfortunately, I have not found a way to do that. Can anyone please help?

1 Answer 1

1

There's now a way to customize any error message.

API docs:

Example:

ErrorText.localizeError = (BuildContext context, FirebaseAuthException e) {
  // I'm assuming this should be the code, but it might be different
  if (e.code == -47) return 'Custom message goes here';
  
  final defaultLabels = FirebaseUILocalizations.labelsOf(context);
  return localizedErrorText(e.code, defaultLabels);
}
Sign up to request clarification or add additional context in comments.

1 Comment

I solved it by putting ErrorText inside the actions actions: [ AuthStateChangeAction<AuthFailed>((context, state) { <code here> }), ]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.