You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
770 B
36 lines
770 B
class Order {
|
|
final int id;
|
|
final double totalPrice;
|
|
final String dateTime;
|
|
final DateTime? startDate;
|
|
final String? user;
|
|
|
|
Order({
|
|
required this.id,
|
|
required this.totalPrice,
|
|
required this.dateTime,
|
|
this.startDate,
|
|
this.user,
|
|
});
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'id': id,
|
|
'total_price': totalPrice,
|
|
'date_time': dateTime,
|
|
'start_date': startDate?.toIso8601String(),
|
|
'user': user,
|
|
};
|
|
}
|
|
|
|
factory Order.fromMap(Map<String, dynamic> map) {
|
|
return Order(
|
|
id: map['id'],
|
|
totalPrice: map['total_price'],
|
|
dateTime: map['date_time'],
|
|
startDate:
|
|
map['start_date'] != null ? DateTime.parse(map['start_date']) : null,
|
|
user: map['user'],
|
|
);
|
|
}
|
|
}
|
|
|