is it possible to dynamically access variables? The code below demonstrates what I mean.
for (var i = 0; i < dataList.length; i++) {
var product1 = 20;
var product2 = 30;
product$i = 30;
}
No, that is not possible in Dart and is also not what you really want to do. Instead, you should use List or Map to contain your values if you need to access them in some dynamic way. By doing so, you can achieve statically type safety since Dart will be able to check the types before even running your program.