flutterdartlocalerevenuecat

Flutter get Locale from RevenueCat


I am (happily) using RevenueCat, everything is working perfectly fine.

BUT now I would love to get the users locale, or more specific, the users AppStore locale.

Is there any way to get this from RevenueCat ? The closest I found is:

StoreProduct.currencyCode

I also found that for iOS 13+:

import StoreKit

let country = SKPaymentQueue.default().storefront?.countryCode

Sad enough I didn't find a Flutter way of doing this. Is there any solution for this? Let me know if you need any more information.


Solution

  • You could use the in_app_purchase package and only use it to check country code.

    import 'package:in_app_purchase/in_app_purchase.dart';
    
    Future<String> countryCode() => InAppPurchase.instance.countryCode();
    

    Otherwise you could write your own plugin https://docs.flutter.dev/packages-and-plugins/developing-packages