Skip to content

Instantly share code, notes, and snippets.

@antklim
Last active November 9, 2020 21:22
Show Gist options
  • Select an option

  • Save antklim/26a0ec5e5a5f2c9aa2cad0594f605083 to your computer and use it in GitHub Desktop.

Select an option

Save antklim/26a0ec5e5a5f2c9aa2cad0594f605083 to your computer and use it in GitHub Desktop.
class CalculatorUseCase {
num memory;
Operation operation; // an instance of Operation class
num operandA;
num operandB;
CalculatorUseCase(
{Operation operation, this.operandA = 0, this.operandB = 0}) {
this.operation = operation ?? Add;
}
num get value => operation.oper(operandB)(operandA);
String get format => operation.format(operandB)(operandA);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment