import 'package:json_annotation/json_annotation.dart'; part 'contact_info.g.dart'; @JsonSerializable() class ContactInfo { @JsonKey(name: 'id') int? id; @JsonKey(name: 'phone') String phone; @JsonKey(name: 'remark') String? remark; @JsonKey(name: 'favor') bool? favor; ContactInfo(this.id, this.phone, this.remark, this.favor); factory ContactInfo.fromJson(Map json) => _$ContactInfoFromJson(json); Map toJson() => _$ContactInfoToJson(this); }