mirrorCells method

void mirrorCells(
  1. String direction,
  2. List<Pair<int, int>> origins,
  3. String languageCode
)

It takes a direction and a list of origins, and then it creates a string that represents the code that the user would have to write in order to mirror the cells in the given direction

Args: direction (String): The direction of the mirror. origins (List<Pair<int, int>>): The list of cells to be mirrored.

Implementation

void mirrorCells(
  String direction,
  List<Pair<int, int>> origins,
  String languageCode,
) {
  final List<String> originsPosition = <String>[];
  for (final Pair<int, int> i in origins) {
    originsPosition.add("${rows[i.first]}${i.second + 1}");
  }
  final String code =
      "mirror({${originsPosition.joinToString(separator: ",")}},$direction)";
  _interpreter.validateOnScheme(code, SchemasReader().currentIndex);
  validCommandsBuffer.add(code);
  allCommandsBuffer.addAll(parseToContainer(code, languageCode));
  notifyListeners();
}