fromJson static method

AppointmentModel fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static AppointmentModel fromJson(dynamic value) {
  final json = value.cast<String, dynamic>();
  return AppointmentModel(
    id: mapValueOfType<int>(json, r'id')!,
    serviceId: mapValueOfType<int>(json, r'serviceId')!,
    employeeId: mapValueOfType<int>(json, r'employeeId')!,
    customerId: mapValueOfType<int>(json, r'customerId')!,
    from: mapDateTime(json, r'from', '')!,
    to: mapDateTime(json, r'to', '')!,
    color: mapValueOfType<String>(json, r'color')!,
    eventName: mapValueOfType<String>(json, r'eventName')!,
    status: AppointmentModelStatus.fromJson(json[r'status']),
    recurrenceId: mapValueOfType<int>(json, r'recurrenceId'),
  );
}