calculateDiscountValue static method

String calculateDiscountValue(
  1. String basePrice,
  2. String discountPrice
)

Implementation

static String calculateDiscountValue(
    String basePrice, String discountPrice) {
  try {
    final discountPerc =
        (double.parse(discountPrice) ~/ double.parse(basePrice)) * 100;
    return discountPerc.toString();
  } catch (e) {
    return 'N/A';
  }
}