Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is json and map the same in dart

I am working on json mapping in c# but i couldn’t match in dart.

I was working with json data in dart. Because I was using SQFLite, I started working with map. I couldn’t quite understand the difference between them.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

No, JSON (JavaScript Object Notation) is a lightweight data interchange format that is used for representing structured data in a text format. JSON is a language-independent format, which means it can be used with any programming language.

A map in Dart is a collection of key-value pairs, where each key is unique and is used to identify a specific value in the map. A map can be created using the Map class, which is a generic class that takes two type arguments: the type of the keys and the type of the values. Maps are useful for storing data that needs to be quickly accessed and modified using keys.

Here’s an example of how you can create a map in Dart:

var map = {
  'key1': 'value1',
  'key2': 'value2',
  'key3': 'value3'
};

You can also create a map using the Map class and its constructor:

var map = new Map<String, int>();
map['key1'] = 1;
map['key2'] = 2;
map['key3'] = 3;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading