paint method

void paint(
  1. int a,
  2. int b,
  3. String color,
  4. String languageCode,
  5. {required bool copyCommands}
)

It takes in two integers and a string, and then it paints the cell at the given coordinates with the given color

Args: a (int): the row number b (int): the column number color (String): The color to paint the cell.

Implementation

void paint(
  int a,
  int b,
  String color,
  String languageCode, {
  required bool copyCommands,
}) {
  String code = "go(${rows[a]}${b + 1}),";
  code += " paint($color)";
  _interpreter.validateOnScheme(code, SchemasReader().currentIndex);
  if (copyCommands) {
    copyCommandsBuffer.addAll(code.split(","));
  } else {
    validCommandsBuffer.addAll(code.split(","));
    allCommandsBuffer.addAll(
      code
          .split(",")
          .map(
            (String element) => parseToContainer(element, languageCode),
          )
          .flatten(),
    );
  }
  notifyListeners();
}