toJSON method
Converts this map into a JSON string.
Use optional parameter toEncodable
to convert types that are not a
number, boolean, string, null, list or a map with string keys.
See jsonEncode.
Example:
{'a': 1, 'b': 2}.toJSON(); // '''{'a':1,'b':2}'''
Implementation
String toJSON({Object? Function(Object? nonEncodable)? toEncodable}) {
return jsonEncode(this, toEncodable: toEncodable);
}