MyRank.fromJson constructor

MyRank.fromJson(
  1. Map<String, dynamic> j
)

Implementation

factory MyRank.fromJson(Map<String, dynamic> j) => MyRank(
      leaderboardId: _s(j['leaderboard_id']),
      period: LeaderboardPeriodInfo.fromJson(_map(j['period'])),
      referrerId: _s(j['referrer_id']),
      rank: (j['rank'] as num?)?.toInt(),
      score: (j['score'] as num?)?.toInt() ?? 0,
      pending: (j['pending'] as num?)?.toInt(),
      gapToNext: (j['gap_to_next'] as num?)?.toInt(),
      bestRank: (j['best_rank'] as num?)?.toInt(),
      periodEndsAt: _date(j['period_ends_at']),
      optedOut: j['opted_out'] as bool? ?? false,
    );