It would be desirable to take such heavy things into separate parts. https://medium.com/dartlang/dart-asynchronous-programming-isolates-and-event-loops-bffc3e296a6a ♪ And the triple cycle will always be long, there's nothing you can do. ♪ ♪I can't imagine what this is for, but here's the:import 'dart:convert';
void main() {
print("Start 1");
List<List<List<MapData>>> temp = mapDataFromJson("""
[
[
[
{
"a": "1",
"b": "2",
"c": "3"
},
{
"a": "1",
"b": "2",
"c": "3"
}
],
[
{
"a": "1",
"b": "2",
"c": "3"
},
{
"a": "1",
"b": "2",
"c": "3"
}
],
[
{
"a": "1",
"b": "2",
"c": "3"
},
{
"a": "1",
"b": "2",
"c": "3"
}
]
],
[
[
{
"a": "1",
"b": "2",
"c": "3"
},
{
"a": "1",
"b": "2",
"c": "3"
}
],
[
{
"a": "1",
"b": "2",
"c": "3"
},
{
"a": "1",
"b": "2",
"c": "3"
}
],
[
{
"a": "1",
"b": "2",
"c": "3"
},
{
"a": "1",
"b": "2",
"c": "3"
}
]
]
]
""");
print(temp[0][0][0].a);
print("Start 2");
temp.forEach((x) => x.forEach((y) => y.forEach((z) => print(z.b))));
}
List<List<List<MapData>>> mapDataFromJson(String str) =>
List<List<List<MapData>>>.from(json.decode(str).map(
(x) => List<List<MapData>>.from(x.map(
(x) => List<MapData>.from(
x.map((x) => MapData.fromJson(x)),
),
)),
));
String mapDataToJson(List<List<List<MapData>>> data) =>
json.encode(List<dynamic>.from(
data.map((x) => List<dynamic>.from(
x.map((x) => List<dynamic>.from(
x.map((x) => x.toJson()),
)),
)),
));
class MapData {
final String a;
final String b;
final String c;
MapData({
this.a,
this.b,
this.c,
});
factory MapData.fromJson(Map<String, dynamic> json) => MapData(
a: json["a"],
b: json["b"],
c: json["c"],
);
Map<String, dynamic> toJson() => {
"a": a,
"b": b,
"c": c,
};
}