@@ -36,28 +36,6 @@ String? localizedErrorText(
36
36
/// A widget which displays error text for a given Firebase error code.
37
37
/// {@endtemplate}
38
38
class ErrorText extends StatelessWidget {
39
- /// A way to customize localized error messages.
40
- ///
41
- /// Example usage:
42
- /// ```dart
43
- /// ErrorText.localizeError = (BuildContext context, FirebaseAuthException e) {
44
- /// return switch (e.code) {
45
- /// 'user-not-found' => 'Please create an account first.',
46
- /// 'credential-already-in-use' => 'This email is already in use.',
47
- /// _ => 'Oh no! Something went wrong.'
48
- /// }
49
- /// }
50
- static String Function (
51
- BuildContext context,
52
- FirebaseAuthException exception,
53
- )? localizeError;
54
-
55
- /// A way to customize the widget that is used across the library to show
56
- /// error hints. By default a localized text is used with a color set to
57
- /// [ColorScheme.error] under [MaterialApp] and
58
- /// [CupertinoColors.destructiveRed] under [CupertinoApp] .
59
- static Widget Function (BuildContext context, String message)? builder;
60
-
61
39
/// An exception that contains error details.
62
40
/// Often this is a [FirebaseAuthException] .
63
41
final Exception exception;
@@ -91,16 +69,12 @@ class ErrorText extends StatelessWidget {
91
69
}
92
70
93
71
if (exception is FirebaseAuthException ) {
94
- if (localizeError != null ) {
95
- text = localizeError !(context, exception as FirebaseAuthException );
96
- } else {
97
- final e = exception as FirebaseAuthException ;
98
- final code = e.code;
99
- final newText = localizedErrorText (code, l) ?? e.message;
72
+ final e = exception as FirebaseAuthException ;
73
+ final code = e.code;
74
+ final newText = localizedErrorText (code, l) ?? e.message;
100
75
101
- if (newText != null ) {
102
- text = newText;
103
- }
76
+ if (newText != null ) {
77
+ text = newText;
104
78
}
105
79
}
106
80
0 commit comments