Created
November 4, 2020 07:27
-
-
Save antklim/414a7a018961afb0cdffd797687a5c94 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 _CalculatorInputState extends State<CalculatorInput> { | |
... | |
num get calculatorValue { | |
switch (operation) { | |
case Operation.addition: | |
return operandA + operandB; | |
case Operation.subtraction: | |
return operandA - operandB; | |
case Operation.multiplication: | |
return operandA * operandB; | |
case Operation.division: | |
return operandA / operandB; | |
case Operation.sqrt: | |
return sqrt(operandA); | |
default: | |
return 0; | |
} | |
} | |
String get calculatorFormat { | |
switch (operation) { | |
case Operation.addition: | |
return '$operandA + $operandB'; | |
case Operation.subtraction: | |
return '$operandA - $operandB'; | |
case Operation.multiplication: | |
return '$operandA * $operandB'; | |
case Operation.division: | |
return '$operandA / $operandB'; | |
case Operation.sqrt: | |
return 'sqrt($operandA)'; | |
default: | |
return ''; | |
} | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment