FormulaParser constructor

FormulaParser(
  1. String expression, [
  2. Map<String, dynamic>? options
])

Constructs a FormulaParser instance with the given expression and options.

Implementation

FormulaParser(this.expression, [this.options]) {
  String tempExp = expression;
  options?.forEach((key, value) {
    if (availableFunctions.contains(key.toLowerCase()) &&
        tempExp.contains(key.toLowerCase())) {
      _isReservedWordsUsed = true;
      _reservedWordsUsed.add(key);
    } else {
      tempExp = tempExp.replaceAll(key, value!.toString());
    }
  });

  // remove unnecessary spaces
  // & make it all uppercase to make the parsing easier
  _inputExpression = tempExp.toUpperCase().replaceAll(" ", "");
}