GameProfileModel.fromJson constructor
GameProfileModel.fromJson(
- Map<String, dynamic> json
)
Implementation
factory GameProfileModel.fromJson(Map<String, dynamic> json) {
return GameProfileModel(
id: json['id'],
userId: json['userId'],
companyId: json['companyId'],
totalXp: json['totalXp'] ?? 0,
level: json['level'] ?? 1,
currentLevelXp: json['currentLevelXp'] ?? 0,
xpToNextLevel: json['xpToNextLevel'] ?? 100,
streak: json['streak'] ?? 0,
lastActivityDate: json['lastActivityDate'] != null
? DateTime.parse(json['lastActivityDate'])
: null,
createdAt: json['createdAt'] != null
? DateTime.parse(json['createdAt'])
: null,
updatedAt: json['updatedAt'] != null
? DateTime.parse(json['updatedAt'])
: null,
);
}