在颤振/飞镖中创建一个二维数组 [英] Creating a 2d array in flutter / dart
本文介绍了在颤振/飞镖中创建一个二维数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对颤振和飞镖是全新的.我搜索了谷歌,我能找到的只是如何在颤动中制作一维列表.我需要一张价值图表.
I'm brand new to flutter and dart. I've searched google and all I can find is how to make 1d lists in flutter. I need a chart of values.
具体来说,我需要一个 12 长的行和一个 31 长的列,其中填充了升序数字
Specifically I need a row 12 long and a column 31 long filled with ascending numbers
1, 32, 63,
2, 33, 64,
3, 34, 65, etc....
谢谢!
推荐答案
int row = 3;
int col = 4;
var twoDList = List.generate(row, (i) => List(col), growable: false);
//For fill;
twoDList[0][1] = "deneme";
print(twoDList);
// [[null, deneme, null, null], [null, null, null, null], [null, null, null, null]]
您的二维列表有 3 行 4 列.
Your 2D list having 3 rows and 4 columns.
这篇关于在颤振/飞镖中创建一个二维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文