Here is some example dart code generated with the option to use Map in the method names:
List<Sensordata> sensordataFromMap(String str) => List<Sensordata>.from(json.decode(str).map((x) => Sensordata.fromMap(x)));
String sensordataToMap(List<Sensordata> data) => json.encode(List<dynamic>.from(data.map((x) => x.toMap())));
class Sensordata {
Sensordata({
this.sensor,
this.data,
});
final String sensor;
final List<Datum> data;
factory Sensordata.fromMap(Map<String, dynamic> json) => Sensordata(
sensor: json["sensor"],
data: List<Datum>.from(json["data"].map((x) => Datum.fromMap(x))),
);
Map<String, dynamic> toMap() => {
"sensor": sensor,
"data": List<dynamic>.from(data.map((x) => x.toMap())),
};
}
The first two functions sensordataFromMap and sensordataToMap process a JSON String, not a Map, and should be named as they are without the option, i.e. sensordataFromJson and sensordataToJson.
Here is some example
dartcode generated with the option to useMapin the method names:The first two functions
sensordataFromMapandsensordataToMapprocess a JSONString, not aMap, and should be named as they are without the option, i.e.sensordataFromJsonandsensordataToJson.