Replace empty issuer with null.

This commit is contained in:
Dain Nilsson 2023-12-06 09:16:29 +01:00
parent d8988c2227
commit 33b727b238
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8

View File

@ -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