localizeError property

(String Function(BuildContext context, FirebaseAuthException exception)?) localizeError
getter/setter pair

A way to customize localized error messages for FirebaseAuthException.

Example usage:

ErrorText.localizeError = (BuildContext context, FirebaseAuthException e) {
  final defaultLabels = FirebaseUILocalizations.labelsOf(context);

  return switch (e.code) {
    'user-not-found' => 'Please create an account first.',
    'credential-already-in-use' => 'This email is already in use.',
    _ => localizedErrorText(e.code, defaultLabels) ?? 'Oh no! Something went wrong.',
  }
}

Implementation

static String Function(
  BuildContext context,
  fba.FirebaseAuthException exception,
)? localizeError;