paintMultiple method

void paintMultiple(
  1. List<Pair<int, int>> positions,
  2. List<String> colors,
  3. String languageCode,
  4. {required bool copyCommands}
)

It takes a list of positions and a list of colors, and for each position, it goes to that position and paints it with the corresponding color

Args: positions (List<Pair<int, int>>): A list of pairs of integers. Each pair represents the row and column of the cell to be painted. colors (List): a list of colors to paint the cells with.

Implementation

void paintMultiple(
  List<Pair<int, int>> positions,
  List<String> colors,
  String languageCode, {
  required bool copyCommands,
}) {
  final List<String> command = CommandsInspector.main(
    positions,
    colors,
    copyCommands: copyCommands,
  );
  _interpreter.validateOnScheme(
    command.joinToString(),
    SchemasReader().currentIndex,
  );
  if (copyCommands) {
    copyCommandsBuffer.addAll(command);
  } else {
    validCommandsBuffer.addAll(command);
    allCommandsBuffer.addAll(
      command
          .map(
            (String element) => parseToContainer(element, languageCode),
          )
          .flatten(),
    );
  }
  notifyListeners();
}