Categories.fromJson constructor Null safety

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

Implementation

Categories.fromJson(Map<String, dynamic> json) {
  if (json['trivia_categories'] != null) {
    triviaCategories = <TriviaCategories>[];
    json['trivia_categories'].forEach((v) {
      triviaCategories!.add(TriviaCategories.fromJson(v));
    });
  }
}