forEachState method
bool
forEachState(
- void func(
- StateX<
StatefulWidget> state
- StateX<
- bool? reversed,
- StateX<
StatefulWidget> ? remove,
inherited
To externally 'process' through the State objects.
Invokes func
on each StateX possessed by this StateX object.
With an option to process in reversed chronological order
Implementation
bool forEachState(void Function(StateX state) func,
{bool? reversed, StateX? remove}) {
bool each = true;
final list = statesList(reversed: reversed, remove: remove);
for (final StateX state in list) {
try {
if (state.mounted && !state._deactivated) {
func(state);
}
} catch (e, stack) {
each = false;
// Record the error
if (this is StateX) {
(this as StateX).recordException(e, stack);
}
}
}
return each;
}