reorderCommand method

void reorderCommand(
  1. int from,
  2. int to
)

Reorder command.

Implementation

void reorderCommand(int from, int to) {
  final value = selected;
  if (value == null || from == to || from < 0 || to < 0 || from >= value.commands.length || to >= value.commands.length) {
    return;
  }
  final commands = List<NmOperatorCommand>.of(value.commands);
  final item = commands.removeAt(from);
  commands.insert(to, item);
  _update(value.copyWith(commands: commands));
}