Study.fromJson constructor
Implementation
factory Study.fromJson(Map<String, dynamic> json) {
final study = _$StudyFromJson(json);
final List? repo = json['repo'] as List?;
if (repo != null && repo.isNotEmpty) {
study.repo = Repo.fromJson((json['repo'] as List)[0] as Map<String, dynamic>);
}
final List? invites = json['study_invite'] as List?;
if (invites != null) {
study.invites = invites.map((json) => StudyInvite.fromJson(json as Map<String, dynamic>)).toList();
}
final int? participantCount = json['study_participant_count'] as int?;
if (participantCount != null) {
study.participantCount = participantCount;
}
final int? endedCount = json['study_ended_count'] as int?;
if (endedCount != null) {
study.endedCount = endedCount;
}
final int? activeSubjectCount = json['active_subject_count'] as int?;
if (activeSubjectCount != null) {
study.activeSubjectCount = activeSubjectCount;
}
final List? missedDays = json['study_missed_days'] as List?;
if (missedDays != null) {
study.missedDays = List<int>.from(json['study_missed_days'] as List);
}
return study;
}