calculateDiscountValue static method
Implementation
static String calculateDiscountValue(
String originalPrice, String discountPrice) {
try {
double discountPerc =
((1 - (double.parse(discountPrice) / double.parse(originalPrice))) * 100).ceilToDouble();
if((discountPerc.isNegative) || (discountPerc == 0)){
return 'N/A';
}
else{
return discountPerc.text;
}
} catch (e) {
return 'N/A';
}
}