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 302 views
302 views asked Apr 22, 2023 by avibootz
1 answer 175 views
1 answer 147 views
1 answer 201 views
1 answer 139 views
...