fromJson static method

PatchedTutorProfileOnboarding? fromJson(
  1. dynamic value
)

Returns a new PatchedTutorProfileOnboarding instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static PatchedTutorProfileOnboarding? fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();

    // Ensure that the map contains the required keys.
    // Note 1: the values aren't checked for validity beyond being non-null.
    // Note 2: this code is stripped in release mode!
    assert(() {
      requiredKeys.forEach((key) {
        assert(json.containsKey(key), 'Required key "PatchedTutorProfileOnboarding[$key]" is missing from JSON.');
        assert(json[key] != null, 'Required key "PatchedTutorProfileOnboarding[$key]" has a null value in JSON.');
      });
      return true;
    }());

    return PatchedTutorProfileOnboarding(
      name: mapValueOfType<String>(json, r'name'),
      firstName: mapValueOfType<String>(json, r'first_name'),
      lastName: mapValueOfType<String>(json, r'last_name'),
      phoneNumber: mapValueOfType<String>(json, r'phone_number'),
      email: mapValueOfType<String>(json, r'email'),
      hasDbsUpdateService: mapValueOfType<bool>(json, r'has_dbs_update_service'),
      dbsNumber: mapValueOfType<String>(json, r'dbs_number'),
      dbsDateOfIssue: mapDateTime(json, r'dbs_date_of_issue', r''),
      dbsScan: mapValueOfType<String>(json, r'dbs_scan'),
      video: mapValueOfType<String>(json, r'video'),
      videoLink: mapValueOfType<String>(json, r'video_link'),
      photo: mapValueOfType<String>(json, r'photo'),
      postcode: mapValueOfType<String>(json, r'postcode'),
      hasSkype: mapValueOfType<bool>(json, r'has_skype'),
      subjects: TutorSubject.listFromJson(json[r'subjects']),
      experienceYears: mapValueOfType<int>(json, r'experience_years'),
      experience: mapValueOfType<String>(json, r'experience'),
      tagline: mapValueOfType<String>(json, r'tagline'),
      files: TutorProfileFiles.listFromJson(json[r'files']),
      onlineTutoring: mapValueOfType<bool>(json, r'online_tutoring'),
      inPersonTutoring: mapValueOfType<bool>(json, r'in_person_tutoring'),
      profilePhotoRejected: mapValueOfType<bool>(json, r'profile_photo_rejected'),
      profileSubmitted: mapValueOfType<bool>(json, r'profile_submitted'),
      qualifications: TutorQualification.listFromJson(json[r'qualifications']),
      references: TutorReferenceCreate.listFromJson(json[r'references']),
      statementConfirmation: mapValueOfType<bool>(json, r'statement_confirmation'),
      handbook: mapValueOfType<bool>(json, r'handbook'),
      tutorIDImage: mapValueOfType<String>(json, r'tutor_ID_image'),
      tutorCv: mapValueOfType<String>(json, r'tutor_cv'),
    );
  }
  return null;
}