What i’m trying to achieve is something similar to this
bigArray [
[val1, val2, val3],
[val1, val2, val3],
.
.
.
]
basically each inner array has a fixed length of 4, whereas the outer array (bigArray) contains all the inner arrays.
I know this is possible in Java, but i have not been able to recreate it in Flutter
2
Answers
You can use
List<List<T>>
without complications, but I think aMap<String,List<T>>
will suit you best.Yes, it is possible to create an array of arrays in Dart and Flutter. You can do this by creating a list of lists, where each element in the list is another list with a fixed length.
Note that in Dart, you don’t need to specify the type of the inner lists explicitly when declaring bigArray, as the type inference will automatically infer the type based on the initialization. However, if you want to be explicit about the types, you can declare bigArray like this: