forEach method
To externally 'process' through the controllers.
Invokes func
on each StateXController possessed by this StateX object.
With an option to process in reversed chronological order
Implementation
bool forEach(void Function(StateXController con) func, {bool? reversed}) {
bool each = true;
Iterable<StateXController> list;
// In reversed chronological order
if (reversed != null && reversed) {
list = controllerList.reversed;
} else {
list = controllerList;
}
for (final StateXController con in list) {
try {
func(con);
} catch (e, stack) {
each = false;
if (this is StateX) {
(this as StateX).recordException(e, stack);
}
}
}
return each;
}