create static method

List<Preset> create(
  1. List<PresetInfo> infos,
  2. List<Zone> zones,
  3. List<Instrument> instruments
)

Implementation

static List<Preset> create(List<PresetInfo> infos, List<Zone> zones, List<Instrument> instruments) {
  if (infos.length <= 1) {
    throw "No valid preset was found.";
  }

  // The last one is the terminator.
  int count = infos.length - 1;

  List<Preset> presets = [];

  for (var i = 0; i < count; i++) {
    presets.add(Preset.fromInfo(infos[i], zones, instruments));
  }

  return presets;
}