flutter map to json code example
Example 1: dart map to json string
import 'dart:convert';
...
json.encode(data); // JSON.encode(data) in Dart 1.x
Example 2: parse json to dart model
import 'dart:convert';
main() {
String nestedObjText =
'{"title": "Dart Tutorial", "description": "Way to parse Json", "author": {"name": "bezkoder", "age": 30}}';
Tutorial tutorial = Tutorial.fromJson(jsonDecode(nestedObjText));
print(tutorial);