course-work/lib/models/item.dart
2022-12-27 08:13:07 +03:00

36 lines
693 B
Dart

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);
Item({
required this.title,
required this.id,
this.description,
this.price,
this.quantity,
});
final String title;
final String? description;
final int? price;
final int id;
final int? quantity;
// tojson
Map<String, dynamic> toJson() => _$ItemToJson(this);
@override
List<Object?> get props => [
title,
description,
price,
id,
quantity,
];
}