File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
packages/gotrue/lib/src/types Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change
1
+ import 'package:collection/collection.dart' ;
1
2
import 'package:gotrue/gotrue.dart' ;
2
3
3
4
class AuthMFAEnrollResponse {
@@ -270,7 +271,8 @@ enum AMRMethod {
270
271
emailChange ('email_change' ),
271
272
tokenRefresh ('token_refresh' ),
272
273
anonymous ('anonymous' ),
273
- mfaPhone ('mfa/phone' );
274
+ mfaPhone ('mfa/phone' ),
275
+ unknown ('unknown' );
274
276
275
277
final String code;
276
278
const AMRMethod (this .code);
@@ -294,9 +296,10 @@ class AMREntry {
294
296
295
297
factory AMREntry .fromJson (Map <String , dynamic > json) {
296
298
return AMREntry (
297
- method: AMRMethod .values.firstWhere (
298
- (e) => e.code == json['method' ],
299
- ),
299
+ method: AMRMethod .values.firstWhereOrNull (
300
+ (e) => e.code == json['method' ],
301
+ ) ??
302
+ AMRMethod .unknown,
300
303
timestamp: DateTime .fromMillisecondsSinceEpoch (json['timestamp' ] * 1000 ),
301
304
);
302
305
}
You can’t perform that action at this time.
0 commit comments