We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File 1: a_response.dart
import 'package:json_annotation/json_annotation.dart'; part 'a_response.g.dart'; abstract class TypedResponse { final String objType; <-- base class has this attribute TypedResponse(this.objType); } class AResponse extends TypedResponse { String name; AResponse(this.name) : super('A'); factory AResponse.fromJson(Map<String, dynamic> json) => _$AResponseFromJson(json); Map<String, dynamic> toJson() => _$AResponseToJson(this); }
Generated file : a_response.g.dart:
AResponse _$AResponseFromJson(Map<String, dynamic> json) { return AResponse(json['name'] as String); } Map<String, dynamic> _$AResponseToJson(AResponse instance) { final val = <String, dynamic>{}; void writeNotNull(String key, dynamic value) { if (value != null) { val[key] = value; } } writeNotNull('name', instance.name); <-- missing objType from base class return val; }
In the pubspec.yaml, using json_annotation: ^2.0.0
Am I missing something or is this a bug? Thanks.
The text was updated successfully, but these errors were encountered:
There is no constructor argument for objType, so it's not generated. This is by design.
objType
Sorry, something went wrong.
Duplicate of #274
No branches or pull requests
File 1: a_response.dart
Generated file : a_response.g.dart:
In the pubspec.yaml, using
json_annotation: ^2.0.0
Am I missing something or is this a bug? Thanks.
The text was updated successfully, but these errors were encountered: