json_serializable.dart
json_serializable.dart copied to clipboard
Generates utilities to aid in serializing to/from JSON.
### Minimum reproducible code: ```dart @JsonSerializable() class Foo { final int a = 0; int get b => 42; } ``` ### Problem: The generated code doesn't include any of...
I have a `CustomJsonConverter` defined in a separate library which i want to import using a library prefix. ```dart import 'library.dart' as converter; @JsonSerializable() class MyObject { // .... @converter.CustomJsonConverter()...
Hey, I have a model like this, in this scenario in failure case my data can be empty and there will be an error in response. Something like this. But...
Consider a structure like the following: ```dart abstract class MyBaseClass { @JsonKey(name: 'myCustomGetterName'); String get myGetter; @JsonKey(name: 'myCustomFieldName'); final String myField; } @JsonSerializable(createFactory: false) class MySuperclass implements MyBaseClass { @override...
### Versions Content of my `pubspec.yaml`: ```yaml name: hello_world dependencies: build_runner: ^2.1.8 characters: ^1.2.0 json_annotation: ^4.4.0 json_serializable: ^6.1.5 environment: sdk: '>=2.16.0
### Reproducible steps ``` { "id": "123", "firstName": "John", "lastName": "Doe" "age": "27" } ``` ``` import 'package:json_annotation/json_annotation.dart'; @JsonSerializable() class Person { const Person (this.id, this.name, this.age); final String id;...
I'm using JsonSerializable for json request parsing from Django server where I user content_type feature. That means that I have generic foreign relationship between Django models which consist of object_id,...
At present, the #585 and PR #691 allows us to annotate `unknownEnumValue` fields of type enum or on Iterable, List, or Set instances of an enum type. Is is possible...
flutter --version ``` Flutter 2.10.3 • channel stable • https://github.com/flutter/flutter.git Framework • revision 7e9793dee1 (3 weeks ago) • 2022-03-02 11:23:12 -0600 Engine • revision bd539267b4 Tools • Dart 2.16.1 •...