Closed lucasdidur closed 1 year ago
Hello,
I'm using the last version of json_serialzable, and create a class to map json keys with variables, but the json key ignores the value to generate the code
Class
@JsonSerializable() class UsuarioModel extends Usuario { UsuarioModel({ @JsonKey(name: 'name') required String nome, @JsonKey(name: 'rf') required String rf, }) : super( nome: nome, rf: rf, ); factory UsuarioModel.fromJson(Map<String, dynamic> json) => _$UsuarioModelFromJson(json); Map<String, dynamic> toJson() => _$UsuarioModelToJson(this); }
Aways generates the variable name to parse inside of .g.dart file
// GENERATED CODE - DO NOT MODIFY BY HAND // ignore_for_file: implicit_dynamic_parameter part of 'usuario.model.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** UsuarioModel _$UsuarioModelFromJson(Map<String, dynamic> json) => UsuarioModel( nome: json['nome'] as String, rf: json['rf'] as String, ); Map<String, dynamic> _$UsuarioModelToJson(UsuarioModel instance) => <String, dynamic>{ 'nome': instance.nome, 'rf': instance.rf, };
build_runner: ^2.3.3 json_annotation: ^4.8.0 json_serializable: ^6.6.1
Hello,
I'm using the last version of json_serialzable, and create a class to map json keys with variables, but the json key ignores the value to generate the code
Class
Aways generates the variable name to parse inside of .g.dart file
build_runner: ^2.3.3 json_annotation: ^4.8.0 json_serializable: ^6.6.1