validateOnScheme method

Pair<Results, CatError> validateOnScheme(
  1. String code,
  2. int schemeIndex
)

It takes a string of code, parses it, and then checks if the code is valid

Args: code (String): The code to be validated. schemeIndex (int): The index of the scheme to validate against.

Returns: A pair of Results and CatError.

Implementation

Pair<Results, CatError> validateOnScheme(String code, int schemeIndex) {
  final Cross? toValidate = schemes.getData[schemeIndex];
  _error = CatError.none;
  _parse(code);
  _results.completed = _commandCaller.board.getCross == toValidate;

  return Pair<Results, CatError>(_results, _error);
}