ProductInfo.dart 570 B

12345678910111213141516171819202122
  1. import 'package:json_annotation/json_annotation.dart';
  2. part 'ProductInfo.g.dart';
  3. @JsonSerializable()
  4. class ProductInfo {
  5. ProductInfo(this.id, this.productName, this.money, this.typeFlag);
  6. int id;
  7. String productName;//名称
  8. int money;//钱
  9. int typeFlag;//类型
  10. factory ProductInfo.fromJson(Map<String, dynamic> json) =>
  11. _$ProductInfoFromJson(json);
  12. Map<String, dynamic> toJson() => _$ProductInfoToJson(this);
  13. // 命名构造函数
  14. ProductInfo.empty();
  15. @override
  16. String toString() {
  17. return _$ProductInfoToJson(this).toString();
  18. }
  19. }