price method

String price()

Returns the product price regardless of platform information

Implementation

String price() {
  if (Platform.isAndroid) {
    var price = defaultPrice?.price ?? "";
    if (price.length > 0) {
      return (double.parse(price) / 100).toStringAsFixed(2);
    }
  } else if (Platform.isIOS) {
    if (purchaseType == "2") {
      var subsPrice = prices?.firstWhere(
          (element) => element.currency == (appleCurrency ?? ""));
      return subsPrice?.price ?? "";
    }
    return appleActivePriceDetail?.price ?? "";
  }
  return "";
}