I saw that this is already answered for javascript but is there a way to break out of an forEach loop in angular dart.
bool hasValue() {
bool result = false;
periods.forEach((item) {
if (item.hasValue()) {
result = true;
//PENDING...Break out of loop early
}
});
return result;
}
As far as I know, you cannot break forEach loop.
You can try this code instead:
for(var item in items) {
final value = item['unit_value'];
if (value.isNotEmpty) {
break;
}
}