mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-23 10:11:52 +03:00
Replace empty issuer with null.
This commit is contained in:
parent
d8988c2227
commit
33b727b238
@ -71,8 +71,14 @@ class OathCredential with _$OathCredential {
|
||||
int period,
|
||||
bool touchRequired) = _OathCredential;
|
||||
|
||||
factory OathCredential.fromJson(Map<String, dynamic> json) =>
|
||||
_$OathCredentialFromJson(json);
|
||||
factory OathCredential.fromJson(Map<String, dynamic> json) {
|
||||
final value = _$OathCredentialFromJson(json);
|
||||
// Replace empty issuer string with null
|
||||
return switch (value.issuer) {
|
||||
(String issuer) when issuer.isEmpty => value.copyWith(issuer: null),
|
||||
_ => value,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@freezed
|
||||
|
Loading…
Reference in New Issue
Block a user