setup static method
Sets up Purchases with your API key and an app user id.
apiKey
RevenueCat API Key.
appUserID An optional unique id for identifying the user.
observerMode
An optional boolean. Set this to TRUE if you have your own
IAP implementation and want to use only RevenueCat's backend.
Default is FALSE.
userDefaultsSuiteName
iOS-only, will be ignored for Android.
Set this if you would like the RevenueCat SDK to store its preferences in a different
NSUserDefaults suite, otherwise it will use standardUserDefaults.
Default is null, which will make the SDK use standardUserDefaults.
useAmazon
Android only. Set this to true if you are building the app
to be distributed in the Amazon Appstore
usesStoreKit2IfAvailable
iOS-only, will be ignored for Android.
RevenueCat currently uses StoreKit 1 for purchases, as its stability in production scenarios has
proven to be more performant than StoreKit 2.
We're collecting more data on the best approach, but StoreKit 1 vs StoreKit 2 is an implementation detail that you shouldn't need to care about.
Simply leave this parameter as default to let RevenueCat decide for you which StoreKit implementation to use. Set this to FALSE to disable StoreKit2.
Implementation
/// [usesStoreKit2IfAvailable] iOS-only, will be ignored for Android.
/// RevenueCat currently uses StoreKit 1 for purchases, as its stability in production scenarios has
/// proven to be more performant than StoreKit 2.
///
/// We're collecting more data on the best approach, but StoreKit 1 vs StoreKit 2 is an implementation detail
/// that you shouldn't need to care about.
///
/// Simply leave this parameter as default to let RevenueCat decide for you which StoreKit implementation to use.
/// Set this to FALSE to disable StoreKit2.
@Deprecated('Use PurchasesConfiguration')
static Future<void> setup(
String apiKey, {
String? appUserId,
bool observerMode = false,
String? userDefaultsSuiteName,
bool useAmazon = false,
bool usesStoreKit2IfAvailable = false,
}) {
final configuration = (PurchasesConfiguration(apiKey)
..appUserID = appUserId
..observerMode = observerMode
..userDefaultsSuiteName = userDefaultsSuiteName
..store = useAmazon ? Store.amazon : null
..usesStoreKit2IfAvailable = usesStoreKit2IfAvailable);
_lastReceivedCustomerInfo = null;
return configure(configuration);
}