Dart for..in Loop
The for..in loop is similar to for loop but different in its syntax. It iterates through an object's properties. The Dart for..in loop accepts an expression as iterator and iterates through the elements one at a time in sequence. The variable var holds the values of the iteration. The for…in will execute until elements remain in iterators.
Dart For In Loop Flow Diagram
Syntax
for (var in expression) {
//statement(s)
}
Example
void main()
{
var list1 = [10,20,30,40,50];
print("Dart for..in loop Example");
for(var i in list1)
{
print(i);
}
}
Output
Dart for..in loop Example
10
20
30
40
50