Closed APPXOTICA closed 1 year ago
This is a test class
@JsonSerializable() class TestClass { TestClass({ this.a, this.b, }); @JsonKey(includeFromJson: false) String? a; @JsonKey(includeToJson: false) String? b; factory TestClass.fromJson(Map<String, dynamic> json) => _$TestClassFromJson(json); Map<String, dynamic> toJson() => _$TestClassToJson(this); }
Below is the generated code.
TestClass _$TestClassFromJson(Map<String, dynamic> json) => TestClass( b: json['b'] as String?, ); Map<String, dynamic> _$TestClassToJson(TestClass instance) => <String, dynamic>{};
includeToJson: false works as expected but includeFromJson : false should not exclude String a from _$TestClassToJson.
includeToJson: false
includeFromJson : false
String a
_$TestClassToJson
Seems like a bug.
json_serializable: ^6.7.0 json_annotation: ^4.8.1
Post as a new issue
This is a test class
Below is the generated code.
includeToJson: false
works as expected butincludeFromJson : false
should not excludeString a
from_$TestClassToJson
.Seems like a bug.
json_serializable: ^6.7.0 json_annotation: ^4.8.1