Questions tagged [json-serializable]

102 questions
0
votes
1 answer

not able to generate JSON conversion classes when classes are extending base class

I am trying to create a Model and using json_serializable package in Flutter but the issue I am facing is when I try to serialize or auto-generate code for the class that is extending base class. So in below class if i remove AuthResponseData it is…
Hunt
  • 8,215
  • 28
  • 116
  • 256
0
votes
1 answer

Can we use json_serializable package to serialize and deserialize user models?

After generating part 'UserModel.g.dart'; successfully, I got the following error upon trying to do if (user != null) { var uid = user.providerData.first.uid; var displayName = user.providerData.first.displayName; var email =…
Jagadish Nallappa
  • 814
  • 1
  • 10
  • 11
0
votes
1 answer

Flutter json_serializable different reference key name switch request

I'm asking a question and not found an similar post for this. I explain, I use json_serializable, but webservice provide some information of the same type of object by with different name keys, exemple : @JsonSerializable(explicitToJson: true) class…
alsub
  • 1
  • 1
0
votes
1 answer

How to cast types with json_serializable in Dart

Is there some way to cast double value from json to int field using json_serializable for code generation? Maybe some annotation? Couldn't find anything like this myself yet. From json like this { "number": 1.0, ... } To class like this class…
0
votes
4 answers

flutter json_serializable missing file

i don't seem to understand why it is showing the error i have created two different .g.dart files but for this file it shows missing part. [WARNING] json_serializable:json_serializable on lib/Model/Supermodel.dart: Missing "part…
user14473358
0
votes
1 answer

JsonSerializable - fromJson throwing _InternalLinkedHashMap exception on nested object

I have used this build.yaml config to allow nested objects to be parsed to json: targets: $default: builders: json_serializable: options: explicit_to_json: true It definitely seems to have…
BeniaminoBaggins
  • 11,202
  • 41
  • 152
  • 287
0
votes
1 answer

flutter run pub run build_runner build failed

[used json annotation and serializable ][1] [Not understanding the error][2]
user14473358
0
votes
1 answer

JSON Encode/Decode List with json_serializable

I'm using the packages: https://pub.dev/packages/json_annotation, https://pub.dev/packages/json_serializable I want to encode/decode a list of objects in my flutter app. The class which is in the list is as follows: @JsonSerializable() class Trial…
Jonah Kornberg
  • 153
  • 1
  • 8
0
votes
3 answers

How to generate .g.dart files correctly when added POST/GET method?

Based on the two images here that I screenshot, I'm confused about making RestClient in Retrofit. When I deleted the Post Method, the part file (api_service.g.dart) didn't get an error. Look at this image : But when I add Post Method, the part file…
Lukmanpryg
  • 166
  • 2
  • 15
0
votes
1 answer

Max length sending JSON to an ASP.NET MVC Action

When I try to send the list of more then 400 records (each won't have more than 900 char length). After setting the maxJsonLength property to its maximum value in web.config still not getting any error. When I try to send the list of less then 30…
0
votes
2 answers

Is there any way to create JsonKey dynamic using JsonSerializable in dart and can we create and get only array from the JsonSerializable class?

Main Question: How to parse this json array using json_serializable? [ { "albumId": 1, "id": 1, "title": "accusamus beatae ad facilis cum similique qui sunt", "url": "http://placehold.it/600/92c952", "thumbnailUrl":…
jazzbpn
  • 6,441
  • 16
  • 63
  • 99
-1
votes
1 answer

Flutter: Issue while converting json to model using json_serializable

Suppose there are two models User and City @JsonSerializable() class User { int id; String name; City? city; } @JsonSerializable() class City { int id; String name; } Now suppose during API call, we've got a user model but in the…
1 2 3 4 5 6
7