Reputation: 14858
I have something like:
Element html = DivElement();
and I add some children from a list of types which have a html element property:
for(var base in bases){
html.children.add(base.html);
}
Is there a way of doing this in Dart like you can in C# syntax?
html.children.addAll(base.select(o => o.html)); //no need for a for-in loop now
Upvotes: 0
Views: 235
Reputation: 14858
use map:
html.children.addAll(bases.map((o) => o.html));
done.
Upvotes: 3