evaluate method

TSimpleOperation evaluate()

Evaluates the current operation and returns the result.

Implementation

TSimpleOperation evaluate() {
  if (isValid) {
    final result = evaluateExpression(toString());

    return TSimpleOperation(
      result: (isDoubleInteger(result) ? result.toInt() : result).toString(),
      isLastOperandPercent: isLastOperandPercent,
      operands: operands,
      operator: operator,
    );
  }

  return this;
}