This commit is contained in:
Phuoc Nguyen
2025-10-10 18:06:40 +07:00
parent 77440ac957
commit 63e397d7e6
12 changed files with 1060 additions and 16 deletions

View File

@@ -14,7 +14,11 @@ class UserModel extends User {
/// Create UserModel from JSON
factory UserModel.fromJson(Map<String, dynamic> json) {
final createdAt = DateTime.parse(json['createdAt'] as String);
// createdAt might not be in response, default to now
final createdAt = json['createdAt'] != null
? DateTime.parse(json['createdAt'] as String)
: DateTime.now();
return UserModel(
id: json['id'] as String,
name: json['name'] as String,