create appointment object

This commit is contained in:
2025-02-12 12:29:41 +02:00
parent cb7b584b63
commit 0f02ade8ff

View File

@@ -0,0 +1,39 @@
class Appointment {
final int idappointments;
final String app_id;
final String business_id;
final String date_time;
final String title;
final String description;
const Appointment({
required this.idappointments,
required this.app_id,
required this.business_id,
required this.date_time,
required this.title,
required this.description,
});
factory Appointment.fromJson(Map<String, dynamic> json) {
return switch (json) {
{
"idappointments": int idappointments,
'app_id': String app_id,
'business_id': String business_id,
'date_time': String date_time,
'title': String title,
'description': String description,
} =>
Appointment(
idappointments: idappointments,
app_id: app_id,
business_id: business_id,
date_time: date_time,
title: title,
description: description,
),
_ => throw const FormatException('Failed to load album.'),
};
}
}