What's up some guys. I am implementing purchases_flutter in my flutter app and I have stumbled upon a problem. I have been following the revenuecat documentation on how to get customer entitlements and then grant them access to certain content. I am doing the following in my code:
final customerInfo = Purchases.getCustomerInfo();
final entitlements = customerInfo.entitlements.active.values.toList();
According to the documents this should work (although Purchaser is now called Customer), but I get a red marking on the '.entitlements' in the second row, with the message 'The getter 'entitlements' isn't defined for the type 'Future' '. I am not sure what I am doing wrong, maybe I am missing something in the documentation. Would appreciate any help I can get. Thanks in advance!
CodePudding user response:
You should await
the call to Purchases.getCustomerInfo()
first like the following code snippet:
final customerInfo = await Purchases.getCustomerInfo();