toJson method Null safety

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> data = <String, dynamic>{};
  if (easy != null) {
    data['Easy'] = easy!.toJson();
  }
  if (medium != null) {
    data['Medium'] = medium!.toJson();
  }
  if (extreme != null) {
    data['Extreme'] = extreme!.toJson();
  }
  if (hard != null) {
    data['Hard'] = hard!.toJson();
  }
  return data;
}