getCalcOperation function

CalcOperation? getCalcOperation(
  1. String? op
)

Implementation

CalcOperation? getCalcOperation(String? op) {
  if (op == null) return null;
  op = op.trim();
  if (op.isEmpty) return null;

  switch (op) {
    case '+':
      return CalcOperation.sum;
    case '-':
      return CalcOperation.subtract;
    case '*':
      return CalcOperation.multiply;
    case '/':
      return CalcOperation.divide;
    default:
      return null;
  }
}