How the pieces connect
Three layers run in different places. Flutter is the client, holding the UI and the purchases_flutter SDK. RevenueCat is a billing proxy: the SDK calls Purchases.purchasePackage(), which routes the actual transaction through StoreKit on iOS and Google Play Billing on Android, then RevenueCat validates the receipt and tracks the subscription. Firebase Auth owns identity, and Firestore holds your app data.
The glue is the app user ID. Call Purchases.logIn(firebaseUser.uid) right after Firebase Auth resolves, so RevenueCat's appUserID equals your Firebase UID. RevenueCat then fires server-to-server webhooks (INITIAL_PURCHASE, RENEWAL, CANCELLATION, EXPIRATION) to a Cloud Function, which writes entitlement state to that user's Firestore document. The client reads getCustomerInfo().entitlements.active for instant UI gating; the server reads Firestore for the trustworthy copy.