Skip to main content
Question

Struggling with RevenueCat + Flutter (Riverpod, Firebase, GoRouter) Integration


Forum|alt.badge.img

Hi everyone! I’m trying to integrate RevenueCat into my Flutter app, which already uses Riverpod for state managementFirebase for auth/onboarding status, and GoRouter for navigation. I’m running into issues with routing redirects, linking Firebase users to RevenueCat, and handling subscription states. Would appreciate guidance or examples!

My Setup:

  1. Authentication: Firebase Auth (users marked as "completed onboarding" in Firestore).

  2. Routing: GoRouter with redirect logic to handle onboarding/auth flows.

  3. RevenueCat: Configured, but struggling to link Firebase users and prevent paywall errors.

Key Issues:

  1. Routing Conflicts:

    • Using redirect in GoRouter, but async checks (onboarding status, subscription) cause race conditions.

    • Example: Sometimes the app shows the paywall even if the user has an active subscription, or redirects incorrectly.

  2. Linking Firebase ↔ RevenueCat:

    • How do I ensure the Firebase user ID is synced with RevenueCat’s user ID after login?

  3. State Management:

    • Using Riverpod to track onboarding, auth, and subscription status. How to coordinate these for routing?

What I’ve Tried:

  • RevenueCat Login: Calling Purchases.logIn(firebaseUID) after Firebase authentication.

  • Routing Logic: Redirecting based on ref.watch(authProvider) and ref.watch(subscriptionProvider), but async states don’t always resolve in time.

Questions:

  1. How do you synchronize Firebase users with RevenueCat reliably?

  2. How to structure GoRouter redirects to wait for async checks (onboarding, subscription)?

  3. Are there working examples of Flutter apps using Riverpod + RevenueCat + GoRouter?

Any code snippets, diagrams, or repos would be incredibly helpful!

 

0 replies

Be the first to reply!

Reply


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