format method
Returns a formatted string representation of the current operation.
Implementation
String format() {
late String operandsString;
if (operands.isEmpty) {
return '';
}
if (operands.length > 1) {
operandsString = operands.map(_formatOperand).join(operator ?? '');
if (isLastOperandPercent) {
operandsString += '%';
}
} else {
operandsString = _formatOperand(operands[0]) + (operator ?? '');
}
return result != null ? '$operandsString=$result' : operandsString;
}