CategoryInformation.fromJson constructor Null safety

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

Implementation

CategoryInformation.fromJson(Map<String, dynamic> json) {
  generalKnowledge = json['GeneralKnowledge'] != null
      ? Easy.fromJson(json['GeneralKnowledge'])
      : Easy(questionsAnswered: 0, questionsRightAnswered: 0);
  art = json['Art'] != null ? Easy.fromJson(json['Art']) : Easy(questionsAnswered: 0, questionsRightAnswered: 0);
  entertainment = json['Entertainment'] != null
      ? Easy.fromJson(json['Entertainment'])
      : Easy(questionsAnswered: 0, questionsRightAnswered: 0);
  science =
  json['Science'] != null ? Easy.fromJson(json['Science']) : Easy(questionsAnswered: 0, questionsRightAnswered: 0);
  mythology =
  json['Mythology'] != null ? Easy.fromJson(json['Mythology']) : Easy(questionsAnswered: 0, questionsRightAnswered: 0);
  history =
  json['History'] != null ? Easy.fromJson(json['History']) : Easy(questionsAnswered: 0, questionsRightAnswered: 0);
  sports = json['Sports'] != null ? Easy.fromJson(json['Sports']) : Easy(questionsAnswered: 0, questionsRightAnswered: 0);
}