@@ -13,36 +13,46 @@ class SetuplocalauthCubit extends Cubit<SetupStage> {
13
13
final lastState = state;
14
14
if (lastState is Base ) {
15
15
final isPinAuthEnabled = await authenticator.isPinAuthenticationEnabled ();
16
- emit (lastState.copyWith (
17
- isPinAuthEnabled: isPinAuthEnabled, isLoading: false ));
16
+ emit (
17
+ lastState.copyWith (
18
+ isPinAuthEnabled: isPinAuthEnabled,
19
+ isLoading: false ,
20
+ ),
21
+ );
18
22
19
23
if (! isPinAuthEnabled) {
20
- emit (lastState.copyWith (
21
- isBiometricAuthAvailable: false ,
22
- isBiometricAuthEnabled: false ,
23
- isLoading: false ,
24
- isPinAuthEnabled: isPinAuthEnabled,
25
- ));
24
+ emit (
25
+ lastState.copyWith (
26
+ isBiometricAuthAvailable: false ,
27
+ isBiometricAuthEnabled: false ,
28
+ isLoading: false ,
29
+ isPinAuthEnabled: isPinAuthEnabled,
30
+ ),
31
+ );
26
32
return ;
27
33
}
28
34
29
35
final biometrics =
30
36
await authenticator.getBiometricAuthenticationAvailability ();
31
37
if (biometrics is Available ) {
32
- emit (lastState.copyWith (
33
- isPinAuthEnabled: isPinAuthEnabled,
34
- isBiometricAuthAvailable: true ,
35
- isBiometricAuthEnabled: biometrics.isEnabled,
36
- isLoading: false ,
37
- ));
38
+ emit (
39
+ lastState.copyWith (
40
+ isPinAuthEnabled: isPinAuthEnabled,
41
+ isBiometricAuthAvailable: true ,
42
+ isBiometricAuthEnabled: biometrics.isEnabled,
43
+ isLoading: false ,
44
+ ),
45
+ );
38
46
}
39
47
if (biometrics is Unavailable ) {
40
- emit (lastState.copyWith (
41
- isPinAuthEnabled: isPinAuthEnabled,
42
- isBiometricAuthEnabled: false ,
43
- isBiometricAuthAvailable: false ,
44
- isLoading: false ,
45
- ));
48
+ emit (
49
+ lastState.copyWith (
50
+ isPinAuthEnabled: isPinAuthEnabled,
51
+ isBiometricAuthEnabled: false ,
52
+ isBiometricAuthAvailable: false ,
53
+ isLoading: false ,
54
+ ),
55
+ );
46
56
}
47
57
} else {
48
58
emit (const Base (isLoading: true ));
@@ -59,8 +69,10 @@ class SetuplocalauthCubit extends Cubit<SetupStage> {
59
69
final result = biometricAvailability.isEnabled
60
70
? await authenticator.disableBiometricAuthentication ()
61
71
: await authenticator.enableBiometricAuthentication ();
62
- result.fold ((l) => emit (lastState.copyWith (error: l)),
63
- (r) => checkInitialState ());
72
+ result.fold (
73
+ (l) => emit (lastState.copyWith (error: l)),
74
+ (r) => checkInitialState (),
75
+ );
64
76
}
65
77
}
66
78
}
@@ -122,7 +134,8 @@ class SetuplocalauthCubit extends Cubit<SetupStage> {
122
134
final lastState = state;
123
135
if (lastState is Disabling ) {
124
136
final result = await authenticator.disableAuthenticationWithPin (
125
- pin: Pin (lastState.pin));
137
+ pin: Pin (lastState.pin),
138
+ );
126
139
result.fold (
127
140
(l) => emit (lastState.copyWith (pin: '' , error: l)),
128
141
(r) => checkInitialState (),
@@ -173,11 +186,13 @@ class SetuplocalauthCubit extends Cubit<SetupStage> {
173
186
emit (lastState.copyWith (currentPin: '' , error: l));
174
187
break ;
175
188
case LocalAuthFailure .pinNotMatching:
176
- emit (lastState.copyWith (
177
- newPin: '' ,
178
- confirmationPin: '' ,
179
- error: l,
180
- ));
189
+ emit (
190
+ lastState.copyWith (
191
+ newPin: '' ,
192
+ confirmationPin: '' ,
193
+ error: l,
194
+ ),
195
+ );
181
196
break ;
182
197
default :
183
198
emit (lastState.copyWith (error: l));
0 commit comments