Home > Software engineering >  How to add entries to my pathlist in flutter
How to add entries to my pathlist in flutter

Time:10-26

Im trying to add a new set of values into my pathlist for example 3:{ "x" : 30, "y": 30 , "r":10, "color":1} to my pathlist and i am stuck here at pathlist.addentries( what to type here) . Thanks in advance for any help

    Map<int, Map<String, double>> pathList = {
    1: {"x": 10, "y": 10, "r": 10, "color": 0},
    2: {"x": 20, "y": 20, "r": 10, "color": 1},
 
  };

CodePudding user response:

You can simply add new values like

pathList[3] = {"x": 11, "y": 10, "r": 11, "color": 11};
or as any index pathList[i] = {}

CodePudding user response:

You can add one value like this

pathList[3]={ "x" : 30, "y": 30 , "r":10, "color":1};

If you want to add multiple values you can use this

  pathList.addAll({
    4: {"x": 10, "y": 10, "r": 10, "color": 0},
    5: {"x": 20, "y": 20, "r": 10, "color": 1},
  });
  • Related