How to encode Object to Json in flutter

I have a Subject object <pre><code>class Subject { String subjectName; int pages; int fullMarks; Future&lt;Map&lt;String, dynamic&gt;&gt; toJson() async {...

flutter error while trying to retrieve a Map from sharedPreferences

I'm trying to retrieve a <code>Map&lt;String, List&lt;Result&gt;&gt;</code> saved in sharedPreferences using <code>sharedPreferences.setString('key', json.encode(myMap...

Json Data Comes Down But, Object Is Null

I'm trying to pass the JSON data from my server into a premade object in Flutter but, I get a null value even though I passed the data to a variable and the correspond...

How to exclude field only from serialization?

<a href="https://pub.dev/packages/built_value" rel="nofollow noreferrer">Built value</a> has an <a href="https://github.com/google/built_value.dart/pull/291" rel="nofo...

json_serializable plugin doesnt support File type?

I'm using json_serializable plugin, but it doesn't seem to work with File for images. 'myclass.g.dart' is not generated. I don't have any troubles for the other types....

Maps containsKey() fails on serialized objects

I have the following map: <pre><code>Map&lt;MenuItem, int&gt; items = LinkedHashMap(); </code></pre> where the contents are being serialized into disk to surviv...

Dart json_annotation how to group fields by @JsonKey(defaultValue: someValue)?

I would like to group fields with default value if the JSON doesn't contain the key or if the value is <code>null</code>. Instead of putting <code> @JsonKey(defaultVal...

type is not subtype of type Map&lt;String, dynamic&gt;, @JsonSerializable()

I have some issue with my json serialization, I use <code>json_serializable: ^6.2.0</code>, so my code is: <code>shift.dart</code>: <pre><code>import 'packa...

_InternalLinkedHashMap&lt;String, dynamic&gt; is not a subtype of type Iterable&lt;dynamic&gt; in type cast

I am trying to use built_value and json_serializable together for parsing json response coming from server to model classes. Following are the dependencies: <...

Flutter Saving data locally, Shared Preferences versus Save to file

I am building a calendar app and for that I need to save the data locally. The data is in the form of a <code>Map&lt;DateTime,List&lt;dynamic&gt;&gt;</code>. ...

Is there a way to serialize a json response (from a .net API) to replace $ref objects in the list with the complete object in dart?

I have an API that returns a response similar to the one shown in <a href="https://stackoverflow.com/questions/11237540/c-sharp-mvc4-web-api-resulting-json-should-retu...

Dart json_serializable Library Tries To Feed Nested Typed Lists a List&lt;dynamic&gt;

Just getting started with the json_serializable package (and Dart in general). I came across an issue where my simple entity blows up when trying to initialize it from...

NoSuchMethodError: The method [] was called on null

I am new to flutter.I am trying to get a json from api from the following code: <pre><code>final response = await http.get(url, headers: { 'Content-Type':...

what is the meaning of var placeId = json[candidates][0][place_id] as String; in flutter google maps?

I m sorry for asking like those simple questions. because I m noob to json and flutter. I just need to understand this code segment. Please help. <pre><code>var pl...

How to serialize an abstract class in Flutter?

I have an abstract model class that has an abstract function that determines how a widget switches state and I would like to keep it. I am currently trying to implemen...