toMap method Null safety

Map<String, dynamic> toMap()

Encodes PlayerRating object to json map

Implementation

Map<String, dynamic> toMap() => {
      'idplayer': idPlayer == null ? null : idPlayer,
      'idrelease': idRelease == null ? null : idRelease,
      'rating': rating == null ? null : rating,
      'rating_position': ratingPosition == null ? null : ratingPosition,
      'date': date == null
          ? null
          : "${date?.year.toString().padLeft(4, '0')}-${date?.month.toString().padLeft(2, '0')}-${date?.day.toString().padLeft(2, '0')}",
      'tournaments_in_year':
          tournamentsInYear == null ? null : tournamentsInYear,
      'tournament_count_total':
          tournamentCountTotal == null ? null : tournamentCountTotal,
    };