PlayerAchievement.fromJson constructor

PlayerAchievement.fromJson(
  1. Map<String, dynamic> json
)

Implementation

PlayerAchievement.fromJson(Map<String, dynamic> json) {
  id = json['id'];
  progress = num.parse(json['progress'] ?? "0");
  progressPct = double.tryParse(json['progressPct'] ?? "0");
  isAcknowledged = json['isAcknowledged'];

  if (json['validUpto'] != null) {
    validUpto = DateTime.tryParse(json['validUpto'] ?? "");
  }

  achievementIdentifier = json['achievementIdentifier'];
  achievement = json['achievement'] != null
      ? Achievement.fromJson(json['achievement'])
      : null;
}