Loop constructor

Loop({
  1. required bool close(),
  2. required List<Step> steps,
})

Constructs a Loop by a closure test and a list of steps.

Implementation

Loop({
  required final bool Function() close,
  required final List<Step> steps
}) : length = steps.length {
  build = (i) {
    if (close()) return null;
    return steps[i];
  };
}