How to loop through a list of elements by index in Dart

1 Answer

0 votes
void main() {
    List<int> lst = [21, 32, 11, 71, 97]; 
    
    for (var i = 0; i < lst.length; i++) {
        print(lst[i]);
    }
}




/*
run:

21
32
11
71
97

*/

 



answered Oct 8, 2022 by avibootz

Related questions

4 answers 519 views
519 views asked Apr 22, 2023 by avibootz
1 answer 269 views
1 answer 248 views
1 answer 291 views
1 answer 239 views
...