copyWith method

Teacher copyWith({
  1. int? id,
  2. Value<DateTime?> fetchedAt = const Value.absent(),
  3. String? code,
  4. int? semester,
  5. String? nameZh,
  6. Value<String?> nameEn = const Value.absent(),
  7. Value<String?> email = const Value.absent(),
  8. Value<int?> department = const Value.absent(),
  9. Value<String?> title = const Value.absent(),
  10. Value<double?> teachingHours = const Value.absent(),
  11. Value<String?> officeHoursNote = const Value.absent(),
})

Implementation

Teacher copyWith({
  int? id,
  Value<DateTime?> fetchedAt = const Value.absent(),
  String? code,
  int? semester,
  String? nameZh,
  Value<String?> nameEn = const Value.absent(),
  Value<String?> email = const Value.absent(),
  Value<int?> department = const Value.absent(),
  Value<String?> title = const Value.absent(),
  Value<double?> teachingHours = const Value.absent(),
  Value<String?> officeHoursNote = const Value.absent(),
}) => Teacher(
  id: id ?? this.id,
  fetchedAt: fetchedAt.present ? fetchedAt.value : this.fetchedAt,
  code: code ?? this.code,
  semester: semester ?? this.semester,
  nameZh: nameZh ?? this.nameZh,
  nameEn: nameEn.present ? nameEn.value : this.nameEn,
  email: email.present ? email.value : this.email,
  department: department.present ? department.value : this.department,
  title: title.present ? title.value : this.title,
  teachingHours: teachingHours.present
      ? teachingHours.value
      : this.teachingHours,
  officeHoursNote: officeHoursNote.present
      ? officeHoursNote.value
      : this.officeHoursNote,
);