replaceLastOperand method
Replaces the last operand of the current operation with the given operand.
Implementation
TSimpleOperation replaceLastOperand(String operand) {
final updatedOperands = List<String>.from(operands);
if (updatedOperands.isNotEmpty) {
updatedOperands.removeLast();
}
updatedOperands.add(operand);
return TSimpleOperation(
isLastOperandPercent: isLastOperandPercent,
operands: updatedOperands,
operator: operator,
result: result,
);
}