addCommand method

  1. @override
void addCommand(
  1. Map<String, Object> command
)
override

Implementation

@override
void addCommand(Map<String, Object> command) {
  if (commands.isEmpty) {
    commands.add(command);
    commandsOrigin.add({0: operationInputIndex++});
    return;
  }
  var commandKey = command.keys.first;
  var lastCommandKey = commands.last.keys.first;
  if (commandKey == lastCommandKey) {
    var commandValue =
        command.values.toList()[1] as List<Map<String, dynamic>>;
    var lastCommandValues =
        commands.last.values.toList()[1] as List<Map<String, dynamic>>;
    commandsOrigin.last[lastCommandValues.length] = operationInputIndex++;
    lastCommandValues.addAll(commandValue);
  } else {
    commands.add(command);
    commandsOrigin.add({0: operationInputIndex++});
  }
}