open:json-serializable

json_serializable

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
          

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<String> images;
  List<Map<String, String>> sell;
 
  Wine({this.id, this.nameEn, this.nameKo, this.images, this.sell});
 
  factory Wine.fromJson(Map<String, dynamic> json) => _$WineFromJson(json);
 
  Map<String, dynamic> toJson() => _$WineToJson(this);
}


  • open/json-serializable.txt
  • 마지막으로 수정됨: 2021/05/21 13:42
  • 저자 127.0.0.1