updateGroupRule method

void updateGroupRule(
  1. int index, {
  2. int? limitSlot,
  3. String? alg,
  4. String? type,
  5. String? group,
})

Update group rule.

Implementation

void updateGroupRule(int index, {int? limitSlot, String? alg, String? type, String? group}) {
  final current = selected;
  if (current == null) return;
  draft ??= NmZoneDraft(current);
  final rules = List<NmGroupRule>.of(draft!.working.groupRules);
  if (index < 0 || index >= rules.length) return;
  rules[index] = rules[index].copyWith(limitSlot: limitSlot, alg: alg, type: type, group: group);
  draft!.working = draft!.working.copyWith(groupRules: rules);
  notifyListeners();
}