Skip to main content
Solved

Revenuecat Prewarm Issue for Flutter

  • December 23, 2024
  • 1 reply
  • 22 views

Forum|alt.badge.img+2

Taken from this SO post

From the docs

In certain cases, iOS may prewarm your app - this essentially means your app will be launched silently in the background to improve app launch times for your users.

If you are not using RevenueCat's anonymous IDs as described above, and are instead providing your own app user ID on configuration, do not call configure in application:didFinishLaunchingWithOptions:. Instead, call the configure method in your root view controller's initialization method.

I am struggling to understand the implication of this for a flutter app. Is it alright if we initialize Purchases from the main method before runApp is executed or do we have to do it in the initialization method of the application.

So would it work if we do something like

Future<void> main() async {
   await Purchases.configure()
   runApp(MyApp(...)) 
}

Or do we have to do this in MyApp initializer like

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool isInitalized

  @override
  void initState() {
    Purchases.configure().then((_) => isInitalized = true);
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    isInitalized ? return MaterialApp(...) : return CircularProgressIndicator();
  }
}

Looked up docs but no specific info about flutter

Best answer by cody

Hey ​@göktürk-büyüktuna-e51cd9 ,

Generally, I don’t think this is something that’s an issue anymore, and likely isn’t something you need to worry about on Flutter. My understanding is that the issue that caused us to add this message isn’t working the same way, post iOS-15 (https://developer.apple.com/forums/thread/763739).

View original
Did this post help you find an answer to your question?
This post has been closed for comments

1 reply

cody
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 501 replies
  • Answer
  • January 13, 2025

Hey ​@göktürk-büyüktuna-e51cd9 ,

Generally, I don’t think this is something that’s an issue anymore, and likely isn’t something you need to worry about on Flutter. My understanding is that the issue that caused us to add this message isn’t working the same way, post iOS-15 (https://developer.apple.com/forums/thread/763739).


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings