Hey everybody,
I started to implement RevenueCat today into our existing Flutter app and so far I’m really enjoying is. The only thing I’m wondering right now is, is the following debug message that shows up all the time:
ePurchases] - INFO:
Purchases instance already set. Did you mean to configure two Purchases objects?
What I’m doing so far in my code is to initialize the Purchases like that:
Future<void> initSubscriptions() async {
await Purchases.setDebugLogsEnabled(true);
if (Platform.isAndroid) {
// TODO Setup Google
// await Purchases.setup("public_google_sdk_key");
} else if (Platform.isIOS) {
final bool revenueCatAlreadyConfigured = await Purchases.isConfigured;
if (!revenueCatAlreadyConfigured) {
await Purchases.setup("<my_api_key>",
appUserId: "SIMULATOR-TEST-CLIENT");
print("iOS setup finished");
} else {
print("RevenueCat is already configured");
}
} else {
print("Platform doesn't support subscriptions yet");
}
}
This method is called as one of the very first ones in my app.
Initially I didn’t use the “revenueCatAlreadyConfigured” variable and just triggered the setup, as it’s only used once in the init method and I don’t call it anywhere else. After seeing the debug message I introduced the “revenueCatAlreadyConfigured” bool to work around it but in that case RevenueCat is not configured at all and doesn’t return anything.
The debug message is not popping up whenever I build the app from scratch, so I’m not sure if thats a bug with the hot reload, but it confused me, so I wanted to double check. I found some posts about it and that it could lead to several side effects, so it would be good to know the best practice here.
Thanks in advance!