getUsedVariables method

List<String> getUsedVariables()

Returns a list of the variables in the expression.

Returns a list of the variable names in this expression.

Implementation

List<String> getUsedVariables() {
  List<String> result = [];
  _Tokenizer tokenizer = new _Tokenizer(this, _expressionString);
  while (tokenizer.moveNext()) {
    Token nextToken = tokenizer.current!;
    String token = nextToken.toString();
    if (nextToken.type != TokenType.variable ||
        token == "PI" ||
        token == "e" ||
        token == "TRUE" ||
        token == "FALSE") {
      continue;
    }
    result.add(token);
  }
  return result;
}