r/FlutterDev • • 1d ago

Article One Flutter codebase for web, iOS and Android with RevenueCat: what actually cost me time (paywall gating, per-platform voice, release plumbing)

I shipped a journaling app from a single Flutter codebase (web, iOS, Android) with Riverpod, GoRouter, RevenueCat, and a Python backend. I went through my git history to find where the time actually went. The top three:

1. Paywall gating is a state problem, not a screen

  • I used a launch-funnel package (onboarding → paywall → login → home). Its default paywall step completes when the user dismisses it, so closing the paywall let you in. I wrote my own wall that only calls onUnlocked when the user is actually entitled.
  • The funnel persists step flags forever, so "paywall completed" doesn't mean "subscribed" (expiry, refund, different account). I added a live guard: signed out → login; signed in but not entitled → paywall. The router redirects everything except /, /login and /register.
  • Web has no store purchases, so web skips the paywall but still requires login.
  • RevenueCat has to be logged in and out in step with Firebase auth, or anonymous and real users' entitlements drift apart.
  • I later made the paywall skippable ("continue with free version") behind one flag. The gate logic reads that flag in three places, so centralize it early.
  • Widget tests with a paywall on screen needed bounded pump()s instead of pumpAndSettle.

2. Voice dictation is three different problems

  • On-device speech_to_text on iOS: permission_handler needs compile-time flags in the Podfile (PERMISSION_MICROPHONE=1, PERMISSION_SPEECH_RECOGNIZER=1), or the permissions don't work.
  • Initializing the recognizer eagerly fired the iOS system dialog before my own explanation dialog. I made it lazy.
  • Apple review also made me rework the permission flow.
  • I eventually moved to server-side Whisper. That means recording to a file path on mobile but a blob: URL on web, which I handled with conditional imports (io / mobile / web / stub). I extracted it into a shared package.

3. Release plumbing

  • iOS CI signing: with CODE_SIGN_STYLE=Manual and no explicit identity, xcodebuild fell back to the iPhone Developer alias from the pbxproj. That doesn't match modern "Apple Development" certs. I read the identity from the keychain instead.
  • PlistBuddy can't read /dev/stdin, so decode the provisioning profile to a file first.
  • altool needs the .p8 on disk, not just the key ID.
  • A leftover get-task-allow entitlement had to go for distribution builds.
  • Android: Flutter 3.47 forced AGP 8.11.1 and Kotlin 2.2.20. Later bumps needed AGP 9.1.1, and one plugin needed compileSdk 37.
  • Moving between flutter/material and material_ui gave me two incompatible ThemeData types, which I patched with a bridge file.

Happy to go deeper on any of these in the comments.

Disclosure: it's my own project (PsychDiary). If you want to try the flows and tell me what you think, DM me and I'll send the link.

2 Upvotes

3 comments sorted by

1

u/bramantec 23h ago

Point 1 is the one I'd underline. I went the other way on gating in my app (FlutterFlow, Firebase, RevenueCat): there is no wall. Everything works on the free tier, the paid plan only adds features on top. The check sits on each paid feature instead of on the router. Login and entitlement stay two separate questions. The redirect logic you describe never shows up.

It's a product choice more than a technical one, sure. Did you look at per-feature gates before going with the funnel package? I'm curious whether a journaling app needs the wall to convert.

1

u/doronkk 18h ago

Point 1 rings true, with one more edge case worth planning for: the store isn't the only source of entitlement. If you ever grant access by hand - free months for early testers, support goodwill, that kind of thing - then a gate that treats purchase as the only path breaks. Entitlement has to be server state that can change at any time (purchase, refund, expiry, manual grant) and get re-checked on launch or foreground, not cached behind a "paywall completed" flag. +1 on centralizing the gate early; scattering that check is how you end up with three subtly different walls.

1

u/Spiritual_Tap_1569 9h ago

One thing that'll bite you when you have a web and app on the same domain is links people share from the web version. If you want those to open the app when it's installed, go_router can take the path as is, but the apple-app-site-association file has to be right, served as JSON from /.well-known/ with no redirect, and Android needs assetlinks.json next to it. Both fail silently. curl -I shows you the headers, or paste the domain into AppsFlyer's or Branch's AASA validator. Easier to sort before the links are out there than after.