toJson method Null safety

Map<String, dynamic> toJson()

Implementation

Map<String, dynamic> toJson() => {
      'code': code,
      'title': title,
      'className': className,
      'group': group,
      'units': units,
      'hours': hours,
      'required': required,
      'at': at,
      'sectionTimes': times == null
          ? null
          : List<dynamic>.from(times!.map((x) => x.toJson())),
      'location': location == null ? null : location!.toJson(),
      'instructors': instructors == null
          ? null
          : List<dynamic>.from(instructors!.map((x) => x)),
    };