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()"
      }
   ]
}


Solution 1: boformer

You will have to map the command strings to actual method calls:

  void executeCommand(String cmd) {
    switch(cmd) {
      case 'startScreen':
        startScreen();
        break;
      case 'pauseScreen':
        pauseScreen();
        break;
      case 'finishScreen':
        finishScreen();
        break;
    }
  }


Solution 2: Vincent

This will work

List callbacks = [
{
  'name': "test1",
  'callback': test,
},
{
  'name': "test2",
  'callback': test,
}
];

static test() {
    print("TIMER TEST");
}

Function.apply(callbacks['callback'], []);
// or
callbacks['callback'];

Or

List callbacks2 = [
{
  'name': "test",
  'callback': () => test(),
},

];