json_serializable.dart
json_serializable.dart copied to clipboard
Generates utilities to aid in serializing to/from JSON.
Hello everyone I'm new to Flutter. I want to convert JSON data to a generic type in Flutter. ``` class ServiceResult { T result; String message; String errorCode; bool hasError;...
This issue is related to https://github.com/rrousselGit/freezed/issues/423 **Is your feature request related to a problem? Please describe.** I'm building an API wrapper, and I'm dealing with two JSON object that have...
It's really not safe to reference `Map` or `String` in the case where someone does `import "dart:core" as foo;` – in practice this should be rare. Same for other types....
Generated code: ```dart Response _$ResponseFromJson( Map json, T Function(Object json) fromJsonT, ) { return Response() ..status = json['status'] as int ..value = fromJsonT(json['value']); } ``` Seems like it is not...
### Source code ```dart @JsonSerializable class MyClass { @JsonKey(name: 'value1') var value1 = ''; @JsonKey(name: 'value2') final value2 = 'must always be this'; } ``` ### Generated code: ```dart MyClass...
Should use a converter. We could also have the builder dump out help here, too. See https://github.com/google/json_serializable.dart/issues/789
Hey, I found an issue whilst working on my flutter app. (Bit of context first) I have an Activity, it's a base model, containing a DateTime, Firestore DocumentID, user and...
Currently, it appears that `genericArgumentFactories` works only if the mappers use a very specific name format Consider the following example: ```dart @JsonSerializable(genericArgumentFactories: true) class Either { Either(this.first, this.second); factory Either.fromJson(...
No reason to consider these. Would allow one-way processing of JSON that doesn't map 1-to-1 with the resulting object.
* I guess you could have a setter-only for just `fromJson` case. * Don't try to create a write to a property that's only a setter * etc...