forEach method

bool forEach(
  1. void func(
    1. StateXController con
    ), {
  2. bool? reversed,
})
inherited

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;
}