type property

ProductQueryType get type

Implementation

ProductQueryType get type => _type;
set type (Object value)

Implementation

set type(Object value) {
  if (value is ProductQueryType) {
    if (value == ProductQueryType.All) {
      throw ArgumentError(
        'ProductQueryType.All is not supported in RequestPurchaseBuilder. '
        'Use RequestSubscriptionBuilder or specify ProductType.InApp/ProductType.Subs explicitly.',
      );
    }
    _type = value;
    return;
  }
  if (value is ProductType) {
    _type = value == ProductType.InApp
        ? ProductQueryType.InApp
        : ProductQueryType.Subs;
    return;
  }
  if (value is String) {
    final normalized = value.toLowerCase();
    if (normalized.contains('sub')) {
      _type = ProductQueryType.Subs;
    } else {
      _type = ProductQueryType.InApp;
    }
    return;
  }
  throw ArgumentError('Unsupported type assignment: $value');
}