Error in type cast
MarcioRaimo opened this issue · 5 comments
Version of flutter_inapp_purchase
5.3.1
Platforms you faced the error (IOS or Android or both?)
Android
Expected behavior
Return a bool for function FlutterInappPurchase.instance.checkSubscribed(sku: [your sku])
Actual behavior
Unhandled Exception: type 'Future<List?>' is not a subtype of type 'FutureOr<List>' in type cast (flutter_inapp_purchase.dart:561)
Tested environment (Emulator? Real Device?)
Real device (Samsung Galaxy S22+ (SM-S906E), Android 13 (path 01/01/2023)
Steps to reproduce the behavior
final str = await FlutterInappPurchase.instance.initialize();
final subs = await FlutterInappPurchase.instance.checkSubscribed(sku: [your sku]);
@MarcioRaimo Have you got any solutions for this?
@jatinsaini66
I copied the lib to my project and modified the main file, added ? on the types that the compiler was complaining about and stopped throwing errors. I didn't re-test the lib or read further if this could bring any errors later, but for my use case it worked. I'll download the project again and compare the files, run the tests, and post a more detailed solution. (Sorry, English is not my primary language)
FlutterInappPurchase.instance.getProducts doesn't work after flutter 3.7.7 update.