import 'package:json_annotation/json_annotation.dart';
part 'food_cate.g.dart';
@JsonSerializable()
class FoodCate {
String cate;
String img;
List<FoodInfo> info;
FoodCate({this.cate, this.info});
Map<String, dynamic> toJson() => _$FoodCateToJson(this);
factory FoodCate.fromJson(Map<String, dynamic> json) => _$FoodCateFromJson(json);
}
@JsonSerializable()
class FoodInfo {
String id;
String kind;
String title;
String description;
String heat;
String potassium;
String phosphorus;
FoodInfo({
this.id,
this.kind,
this.title,
this.description,
this.heat,
this.potassium,
this.phosphorus,
});
Map<String, dynamic> toJson() => _$FoodInfoToJson(this);
factory FoodInfo.fromJson(Map<String, dynamic> json) =>
_$FoodInfoFromJson(json);
}
在終端機執行:
flutter packages pub run build_runner build --delete-conflicting-outputs
今天: | ![]() ![]() ![]() ![]() |
昨天: | ![]() ![]() ![]() ![]() |
總計: | ![]() ![]() ![]() ![]() ![]() ![]() ![]() |