Solved

Exception "type 'Null' is not a subtype of type 'num' in type cast" after call Purchases.getOfferings()

  • 15 January 2022
  • 1 reply
  • 14 views

Badge

Thanks for the Platform, guys! Started working with RevenueCat on the Flutter and after call

await Purchases.getOfferings()

I get an exception

type 'Null' is not a subtype of type 'num' in type cast

Reproduced on the real and virtual Android devices.

 

I wrote issue, but your bot is too evil to let her in) That's why I ask here. Can you help with a solution?

 

This seems to be happening on deserializing JSON like this in this place:

 

Environment

 

Output of `flutter doctor`

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.22000.434], locale ru-UA)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[√] Chrome - develop for the web
[√] Android Studio (version 2020.3)
[√] Connected device (3 available)
• No issues found!

 

Debug logs


D/[Purchases] - DEBUG(21462): Debug logging enabled
D/[Purchases] - DEBUG(21462): SDK Version - 4.6.0
D/[Purchases] - DEBUG(21462): Initial App User ID - null
D/[Purchases] - DEBUG(21462): Identifying App User ID: $RCAnonymousID:41e419f3c3a8440dbf9a4b11b83bb4e9
D/[Purchases] - DEBUG(21462): Deleting old synced subscriber attributes that don't belong to $RCAnonymousID:41e419f3c3a8440dbf9a4b11b83bb4e9
D/[Purchases] - DEBUG(21462): App foregrounded
D/[Purchases] - DEBUG(21462): PurchaserInfo cache is stale, updating from network in foreground.
D/[Purchases] - DEBUG(21462): Offerings cache is stale, updating from network in foreground
D/[Purchases] - DEBUG(21462): Offerings updated from network.
D/[Purchases] - DEBUG(21462): Skipping updating pending purchase queue since BillingClient is not connected yet.
D/[Purchases] - DEBUG(21462): No subscriber attributes to synchronize.
D/[Purchases] - DEBUG(21462): Listener set
D/[Purchases] - DEBUG(21462): Sending latest PurchaserInfo to listener.

D/[Purchases] - DEBUG(21462): Starting connection for com.android.billingclient.api.BillingClientImpl@e0192dd

D/[Purchases] - DEBUG(21462): Billing Service Setup finished for com.android.billingclient.api.BillingClientImpl@e0192dd
D/[Purchases] - DEBUG(21462): Updating pending purchase queue
D/[Purchases] - DEBUG(21462): API request started: GET /subscribers/%24RCAnonymousID%3A41e419f3c3a8440dbf9a4b11b83bb4e9

D/[Purchases] - DEBUG(21462): API request completed with status: GET /subscribers/%24RCAnonymousID%3A41e419f3c3a8440dbf9a4b11b83bb4e9 304
D/[Purchases] - DEBUG(21462): PurchaserInfo updated, sending to listener.

D/[Purchases] - DEBUG(21462): API request started: GET /subscribers/%24RCAnonymousID%3A41e419f3c3a8440dbf9a4b11b83bb4e9/offerings
D/[Purchases] - DEBUG(21462): API request completed with status: GET /subscribers/%24RCAnonymousID%3A41e419f3c3a8440dbf9a4b11b83bb4e9/offerings 304
D/[Purchases] - DEBUG(21462): Requesting products from the store with identifiers: hp.99.1m, hp.1099.1y
D/[Purchases] - DEBUG(21462): Querying purchases
D/[Purchases] - DEBUG(21462): Cleaning previously sent tokens
D/[Purchases] - DEBUG(21462): Tokens already posted: []
D/[Purchases] - DEBUG(21462): Saving tokens []
D/[Purchases] - DEBUG(21462): Tokens already posted: []
D/[Purchases] - DEBUG(21462): Products request finished for hp.99.1m, hp.1099.1y
D/[Purchases] - DEBUG(21462): Retrieved skuDetailsList: SkuDetails: {"productId":"hp.1099.1y","type":"subs","title":"Годовая подписка (Счастье)","name":"Годовая подписка","price":"299,99 грн.","price_amount_micros":299990000,"price_currency_code":"UAH","description":"Все существующие и будущие варианты картин на год. Анимация и звук по тапу.","subscriptionPeriod":"P1Y","skuDetailsToken":"AEuhp4KneCpN9CFP4IGHzA6d3zyfehMuFCWB1zrxmDZwCpjwLLE57vYU7QgMYvU3YXXf"}, SkuDetails: {"productId":"hp.99.1m","type":"subs","title":"Ежемесячная подписка (Счастье)","name":"Ежемесячная подписка","price":"29,99 грн.","price_amount_micros":29990000,"price_currency_code":"UAH","description":"Все существующие и будущие варианты картин на месяц. Анимация и звук по \nтапу.","subscriptionPeriod":"P1M","skuDetailsToken":"AEuhp4LU9whZq6aEykT7aWoESkFhHGit3-3F1AqIJ8nIdGcNUGS-2qNXqBjb54e-kVfP"}
D/[Purchases] - DEBUG(21462): hp.1099.1y - SkuDetails: {"productId":"hp.1099.1y","type":"subs","title":"Годовая подписка (Счастье)","name":"Годовая подписка","price":"299,99 грн.","price_amount_micros":299990000,"price_currency_code":"UAH","description":"Все существующие и будущие варианты картин на год. Анимация и звук по тапу.","subscriptionPeriod":"P1Y","skuDetailsToken":"AEuhp4KneCpN9CFP4IGHzA6d3zyfehMuFCWB1zrxmDZwCpjwLLE57vYU7QgMYvU3YXXf"}
D/[Purchases] - DEBUG(21462): hp.99.1m - SkuDetails: {"productId":"hp.99.1m","type":"subs","title":"Ежемесячная подписка (Счастье)","name":"Ежемесячная подписка","price":"29,99 грн.","price_amount_micros":29990000,"price_currency_code":"UAH","description":"Все существующие и будущие варианты картин на месяц. Анимация и звук по \nтапу.","subscriptionPeriod":"P1M","skuDetailsToken":"AEuhp4LU9whZq6aEykT7aWoESkFhHGit3-3F1AqIJ8nIdGcNUGS-2qNXqBjb54e-kVfP"}

D/[Purchases] - DEBUG(21462): Vending PurchaserInfo from cache.
D/[Purchases] - DEBUG(21462): Checking if cache is stale AppInBackground false

D/[Purchases] - DEBUG(21462): Vending Offerings from cache
D/[Purchases] - DEBUG(21462): Checking if cache is stale AppInBackground false

 

Project in the RevenueCat: https://app.revenuecat.com/projects/7353a3c5

 

Subscription options on the Google Play Console:


 

icon

Best answer by Andrii Syrokomskyi 17 January 2022, 06:24

View original

1 reply

Badge

Seems to have been fixed. Thanks!

Do you guys have any days off?)

Reply