# json_serializable {{tag>dart json serializable}} ### build.yaml targets: $default: builders: json_serializable: options: # Options configure how source code is generated for every # `@JsonSerializable`-annotated class in the package. # # The default value for each is listed. any_map: true explicit_to_json: true - https://pub.dev/packages/json_serializable#build-configuration field name import 'package:json_annotation/json_annotation.dart'; part 'wine.g.dart'; @JsonSerializable() class Wine { String id; @JsonKey(name: 'name_en') String nameEn; @JsonKey(name: 'name_ko') String nameKo; List images; List> sell; Wine({this.id, this.nameEn, this.nameKo, this.images, this.sell}); factory Wine.fromJson(Map json) => _$WineFromJson(json); Map toJson() => _$WineToJson(this); }