updateDirectionSlot method

void updateDirectionSlot(
  1. int slot, {
  2. int? alg,
  3. bool? nodiff,
  4. int? limitSoft,
  5. int? limitHard,
})

slot must be 1-4 (the editable directions); 0 and 5 are compatibility-only and silently ignored, matching Specifications' edge-case table.

Implementation

void updateDirectionSlot(int slot, {int? alg, bool? nodiff, int? limitSoft, int? limitHard}) {
  if (slot < 1 || slot > 4) return;
  final current = selected;
  if (current == null) return;
  final index = current.directions.indexWhere((d) => d.slot == slot);
  if (index < 0) return;
  final slots = List<NmPlanDirectionSlot>.of(current.directions);
  slots[index] = slots[index].copyWith(alg: alg, nodiff: nodiff, limitSoft: limitSoft, limitHard: limitHard);
  _update(current.copyWith(directions: slots));
}