fromJson static method

JobApplicationTutor? fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static JobApplicationTutor? 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 "JobApplicationTutor[$key]" is missing from JSON.');
        assert(json[key] != null, 'Required key "JobApplicationTutor[$key]" has a null value in JSON.');
      });
      return true;
    }());

    return JobApplicationTutor(
      id: mapValueOfType<int>(json, r'id'),
      appliedAt: mapDateTime(json, r'applied_at', r''),
      jobPost: mapValueOfType<int>(json, r'job_post')!,
      isProfileComplete: mapValueOfType<bool>(json, r'is_profile_complete')!,
      tutor: mapValueOfType<String>(json, r'tutor'),
      rejectedAt: mapDateTime(json, r'rejected_at', r''),
      isActive: mapValueOfType<String>(json, r'is_active'),
      tutorMessage: mapValueOfType<String>(json, r'tutor_message'),
    );
  }
  return null;
}