我正在使用这里的官方 firebase-ui 示例: https://github.com/firebase/flutterfire/tree/master/packages/firebase_ui_auth/example
相反,我想根据收到的错误修改消息以使其更加用户友好。不幸的是,我还没有找到一种方法来做到这一点。有人可以帮忙吗?
现在有一种方法可以自定义任何错误消息。
API文档:
示例:
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);
}