getOldPurchaseDetails method

  1. @override
GooglePlayPurchaseDetails? getOldPurchaseDetails(
  1. ProductDetails productDetails
)
override

This Checks the user's old subscription in Android platform

In case of Apple Platform it handles internally

*productDetails Represent product user wants to buy

Returns GooglePlayPurchaseDetails

Implementation

@override
GooglePlayPurchaseDetails? getOldPurchaseDetails(
    ProductDetails productDetails) {
  GooglePlayPurchaseDetails? oldPurchaseDetails;

  if (_purchases.isNotEmpty &&
      _purchases.last.productID != productDetails.id) {
    oldPurchaseDetails = _purchases.last as GooglePlayPurchaseDetails;
  }
  return oldPurchaseDetails;
}