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.
CodePudding user response:
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;