Questions tagged [json-serializable]

102 questions
0
votes
0 answers

Unable to use Firebase-Auth and Provider to provide custom user class throughout my widget tree

My goal: A custom defined User class that is available throughout my Flutter app and updates according to new data in Firebase. How I tried to accomplish my goal: Obtain uid: Using FirebaseAuth I can successfully authenticate a user and obtain a…
0
votes
1 answer

json_serializable package problematic conversion to double in flutter

I have a following class: import 'package:json_annotation/json_annotation.dart'; part 'account_filter.g.dart'; @JsonSerializable() class AccountFilter { double latitude = 0; double longitude = 0; String city = ""; String country = ""; …
Draško
  • 2,119
  • 4
  • 41
  • 73
0
votes
0 answers

Flutter: error on build, json_serializable stops working after install realm

I'm working in a flutter project and after install realm dependency I started getting this error with json_serializable: [SEVERE] json_serializable... Found more than one matching converter for dynamic. Do you have something similar? Thank you! I…
0
votes
1 answer

json_serializable can't convert datetime to timestamp for firestore

I am using Json_serializable to convert a class for firestore, and I'm having trouble with converting a DateTime - I keep getting the following error: _TypeError (type 'Timestamp' is not a subtype of type 'String' in type cast) The object I'm…
0
votes
1 answer

fromJson and toJson not generated when the build code is put in build.yaml file

If I use the following code in pubspec.yaml file, then the build_runner generates code but if I put it in the build.yaml file, then the code is not generated for fromJson and toJson. targets: $default: builders: json_serializable: …
iDecode
  • 22,623
  • 19
  • 99
  • 186
0
votes
1 answer

Transforming empty nested map to object exception

I'm using json_serializable to parse complex JSON object to my model. Everything works fine except cases when I get empty object instead of Map(second object in example) [ { "id": 123, "ColorPairs": { "MAA172M":…
Autumn_Cat
  • 790
  • 1
  • 14
  • 28
0
votes
0 answers

How to serialize patch request with optionals via json_serializable?

@JsonSerializable class PatchUserDTO { final String? name; final DateTime? birthday; ...OTHER STAFF... } But I need to differentiate between birthday == null and birthday is not set. I guess, nice solution would be class Optional { …
Alexander Farkas
  • 529
  • 3
  • 11
0
votes
1 answer

Dart json serializable - how to return a const IconData

Storing the IconData on the server and retrieving it with the JsonSerializable, lead to the following error on the Jenkin android build. This application cannot tree shake icons fonts. It has non-constant instances of IconData at the following…
Benjamin Sx
  • 653
  • 1
  • 7
  • 18
0
votes
1 answer

Django: Get list of model object fields depending on their type?

Listing fields of models and their objects has been answered successfully here. But i want a generalized way of processing on object fields depending on their types, so that i can serialize them manually in dictionary. e.g:…
azzam
  • 78
  • 10
0
votes
0 answers

How to preserve non-serialized properties using freezed package in dart?

Consider the following dart class using freezed: @freezed class Example with _$Example { const factory Example( {String? fieldA, int? fieldB}) = _Example; factory Example.fromJson(Map json) =>…
Ozaner Hansha
  • 101
  • 1
  • 2
0
votes
1 answer

Flutter error: _InternalLinkedHashMap' is not a subtype of type 'Map

I am using json_annotation to generate the fromJson and toJson functions for my custom class ItemStatus: import 'package:json_annotation/json_annotation.dart'; part 'item.g.dart'; @JsonSerializable(explicitToJson: true, anyMap: true) class…
0
votes
1 answer

i cant figure out why this error type 'Null' is not a subtype of type 'int' in type cast

Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git Framework • revision b8f7f1f986 (hace 2 semanas) • 2022-11-23 06:43:51 +0900 Engine • revision 8f2221fbef Tools • Dart 2.18.5 • DevTools 2.15.0 hello, best regards and I hope…
rroviedo
  • 3
  • 4
0
votes
1 answer

Flutter Serializing objects types problem

I'm using the json_serializable: ^6.3.1 pub package to auto generate toJson() & FromJson() and i'm having this class import 'package:json_annotation/json_annotation.dart'; part 'maintenance_super_request.g.dart'; @JsonSerializable() class…
0
votes
1 answer

C#, json return empty converting from List

I have script as follows but when i try to make json file, it just return empty {} QuizData.cs using System.Collections.Generic; [System.Serializable] public class QuizList { public string quizName; public List questionList =…
LearnProgramming
  • 814
  • 1
  • 12
  • 37
0
votes
0 answers

TypeError: Object of type FileStorage is not JSON serializable

TypeError: Object of type FileStorage is not JSON serializable when i am trying to send file to the flask backend it showes me this error both from the frontend and postman in the terminal also the post man i have tried to change the file to…
Naol BM
  • 31
  • 2