RequestPurchaseProps constructor

RequestPurchaseProps({
  1. required RequestPurchasePropsRequest request,
  2. ProductQueryType? type,
})

Implementation

RequestPurchaseProps({
  required this.request,
  ProductQueryType? type,
}) : type = type ?? (request is RequestPurchasePropsRequestPurchase
        ? ProductQueryType.InApp
        : ProductQueryType.Subs) {
  if (request is RequestPurchasePropsRequestPurchase && this.type != ProductQueryType.InApp) {
    throw ArgumentError('type must be IN_APP when requestPurchase is provided');
  }
  if (request is RequestPurchasePropsRequestSubscription && this.type != ProductQueryType.Subs) {
    throw ArgumentError('type must be SUBS when requestSubscription is provided');
  }
}