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 288 views
288 views asked Apr 22, 2023 by avibootz
1 answer 164 views
1 answer 138 views
1 answer 188 views
1 answer 129 views
...