getStorefrontIOS property

QueryGetStorefrontIOSHandler get getStorefrontIOS

iOS specific: Get storefront

Implementation

gentype.QueryGetStorefrontIOSHandler get getStorefrontIOS => () async {
      if (!_platform.isIOS) {
        throw PurchaseError(
          code: gentype.ErrorCode.IapNotAvailable,
          message: 'Storefront is only available on iOS',
        );
      }

      try {
        final result = await channel.invokeMethod<Map<dynamic, dynamic>>(
          'getStorefrontIOS',
        );
        if (result != null && result['countryCode'] != null) {
          return result['countryCode'] as String;
        }
        throw PurchaseError(
          code: gentype.ErrorCode.ServiceError,
          message: 'Failed to get storefront country code',
        );
      } catch (error) {
        if (error is PurchaseError) {
          rethrow;
        }
        throw PurchaseError(
          code: gentype.ErrorCode.ServiceError,
          message: 'Failed to get storefront: ${error.toString()}',
        );
      }
    };