Course.fromJson constructor Null safety

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

Implementation

factory Course.fromJson(Map<String, dynamic> json) => Course(
      code: json['code'] as String?,
      title: json['title'] as String?,
      className: json['className'] as String?,
      group: json['group'] as String?,
      units: json['units'] as String?,
      hours: json['hours'] as String?,
      required: json['required'] as String?,
      at: json['at'] as String?,
      times: json['sectionTimes'] == null
          ? null
          : List<SectionTime>.from(
              (json['sectionTimes'] as List<dynamic>).map(
                (x) => SectionTime.fromJson(x as Map<String, dynamic>),
              ),
            ),
      location: json['location'] == null
          ? null
          : Location.fromJson(json['location'] as Map<String, dynamic>),
      instructors: json['instructors'] == null
          ? null
          : List<String>.from(
              (json['instructors'] as List<dynamic>).map(
                (dynamic x) => x,
              ),
            ),
    );