Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 创建具有递增索引的颤振颜色贴图_Flutter_Dart - Fatal编程技术网

Flutter 创建具有递增索引的颤振颜色贴图

Flutter 创建具有递增索引的颤振颜色贴图,flutter,dart,Flutter,Dart,如何创建具有相同值但索引不断增加的100地图 我需要遵循这个结构 Map btnmap = { "0": { "a": Colors.grey[800], "b": Colors.grey[800], "c": Colors.grey[800], "d": Colors.grey[800], "s": false, },

如何创建具有相同值但索引不断增加的100地图

我需要遵循这个结构

    Map btnmap = {
  "0": {
    "a": Colors.grey[800],
    "b": Colors.grey[800],
    "c": Colors.grey[800],
    "d": Colors.grey[800],
    "s": false,
  },
  "1": {
    "a": Colors.grey[800],
    "b": Colors.grey[800],
    "c": Colors.grey[800],
    "d": Colors.grey[800],
    "s": false,
  },
  "2": {
    "a": Colors.grey[800],
    "b": Colors.grey[800],
    "c": Colors.grey[800],
    "d": Colors.grey[800],
    "s": false,
  }, [...]
我正试着用这种方法做一些研究

    Map<String,Color>  btnMap = {
        "a": Colors.grey[800],
        "b": Colors.grey[800],
        "c": Colors.grey[800],
        "d": Colors.grey[800],
       }

var list = List<Map>.filled(100, btnMap);
Map btnMap={
“a”:颜色。灰色[800],
“b”:颜色。灰色[800],
“c”:颜色。灰色[800],
“d”:颜色。灰色[800],
}
var list=list.filled(100,btnMap);

但这并不能解决我的问题,因为我不能为每一个都有一个不断增长的++索引,我该如何解决这个问题?感谢阅读。

通过为收集
,您可以获得想要的东西:

final btnmap={
对于(变量i=0;i<100;i++)“$i”:{
“a”:颜色。灰色[800],
“b”:颜色。灰色[800],
“c”:颜色。灰色[800],
“d”:颜色。灰色[800],
“s”:假,
},
};