Does Dart compile that for loop down to a regular for loop instead of the JS for..in loop? Or are there any safeguards against someone adding a property to an array (not that they should)?
a = [1,2,3];
a.prop = "oops";
for(el in a)
console.log(el);
// > 0
// > 1
// > 2
// > oops
Reducing boilerplate for loop code:
Dart hasn't really optimizing for iterating over a collection with indices since we don't find that very common in real-world code.Better iteration over objects:
Here, obj is a map data structure, not a random object since Dart distinguishes objects and data structures.Default function params:
String interpolation: