next method

SetupCatalog next(
  1. List<SetupStep> steps
)

The catalog that follows this one for steps, the steps of the apps now: its retired steps are those of this catalog and the steps that left the apps, each as this catalog has it, but for a step that is among steps again, in the order of their ids.

Implementation

SetupCatalog next(List<SetupStep> steps) {
  final current = {for (final step in steps) step.id};
  final retired = {
    // A step of the apps of this catalog replaces a retired step with
    // its id, which a catalog written by hand could have.
    for (final step in [...this.retired, ...this.steps])
      if (!current.contains(step.id)) step.id: step,
  };
  return SetupCatalog(
    steps: List.unmodifiable(steps),
    retired: List.unmodifiable([
      for (final id in retired.keys.toList()..sort()) retired[id]!,
    ]),
  );
}