2022-12-27 05:13:07 +00:00
|
|
|
import 'package:equatable/equatable.dart';
|
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
|
|
|
|
part 'item.g.dart';
|
|
|
|
|
|
|
|
@JsonSerializable()
|
|
|
|
class Item extends Equatable {
|
|
|
|
factory Item.fromJson(final Map<String, dynamic> json) =>
|
|
|
|
_$ItemFromJson(json);
|
2022-12-27 03:19:49 +00:00
|
|
|
Item({
|
|
|
|
required this.title,
|
|
|
|
required this.id,
|
2022-12-27 05:13:07 +00:00
|
|
|
this.description,
|
|
|
|
this.price,
|
|
|
|
this.quantity,
|
2022-12-27 03:19:49 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
final String title;
|
2022-12-27 05:13:07 +00:00
|
|
|
final String? description;
|
|
|
|
final int? price;
|
2022-12-27 03:19:49 +00:00
|
|
|
final int id;
|
2022-12-27 05:13:07 +00:00
|
|
|
final int? quantity;
|
|
|
|
|
|
|
|
// tojson
|
|
|
|
Map<String, dynamic> toJson() => _$ItemToJson(this);
|
|
|
|
|
|
|
|
@override
|
|
|
|
List<Object?> get props => [
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
price,
|
|
|
|
id,
|
|
|
|
quantity,
|
|
|
|
];
|
2022-12-27 03:19:49 +00:00
|
|
|
}
|