Skip to content

Commit

Permalink
Replace empty issuer with null.
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Dec 6, 2023
1 parent d8988c2 commit 33b727b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/oath/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 33b727b

Please sign in to comment.