I wanna create a dynamic ListView and each item has a onTap property from a json configuration file.
Rest of the code runs properly.
How I do to Call this string stored command on a onTap property?
This Method retrieve the menu loaded and mount the Listview
Widget _itemBuilder(BuildContext context, int index) {
Menu myMenu = Menu(menu[index]);
return new ListTile(
leading: new Text("-"),
title: new Text("Comando ${myMenu.name}"),
onTap: <myMneu.command>,
);
}
json file
{
"menu": [
{
"id": 1,
"name": "Start",
"command": "StartScreen()"
},
{
"id": 2,
"name": "Pause",
"command": "PauseScreen()"
},
{
"id": 3,
"name": "Finish",
"command": "FinishScreen()"
}
]
}