toJson method
Implementation
Map<String, dynamic> toJson() {
// Lists cannot be automatically be generated, this is why this method is convoluted
Map<String, dynamic> pointsMap = {};
graph.forEach((k, v) {
for (var element in v) {
pointsMap[k.id] = element.toJson();
}
});
return {'graph': pointsMap};
}