Skip to content

Commit

Permalink
fix: added fix if user id is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Benimautner committed Oct 2, 2024
1 parent 087e39f commit b5dae42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/models/user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class User {
this.updated = updated ?? DateTime.now();

User.fromJson(Map<String, dynamic> json)
: id = json['id'],
: id = json.containsKey('id') ? json['id'] : 0,
name = json.containsKey('name') ? json['name'] : '',
username = json['username'],
created = DateTime.parse(json['created']),
Expand Down

0 comments on commit b5dae42

Please sign in to comment.