【发布时间】:2021-11-26 21:16:12
【问题描述】:
我需要将此 Json 映射到递归类,知道吗?
[
{
"title": "home",
"icono": "assets/iconos/home.png",
"children": [
{
"title": "sub home 1",
"icono": "assets/iconos/home.png",
"children": [
{
"title": "sub home 2",
"icono": "assets/iconos/home.png",
"children": []
}
]
}
]
},
{
"title": "home",
"icono": "assets/iconos/home.png",
"children": []
}
]
class Entry {
Entry(this.title,this.icono,[this.children = const <Entry>[]]);
final String title;
final String icono;
final List<Entry> children;
}
【问题讨论】:
-
请解释问题,添加一些您尝试过的代码。