Last active
November 9, 2020 21:22
-
-
Save antklim/26a0ec5e5a5f2c9aa2cad0594f605083 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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