toJson method Null safety

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = <String, dynamic>{};
  if (triviaCategories != null) {
    data['trivia_categories'] =
        triviaCategories!.map((v) => v.toJson()).toList();
  }
  return data;
}