App core
Application startup
Initializes Flutter bindings, env, RevenueCat, Firebase, analytics, notifications, and platform SDKs before runApp.
In one sentence
Cold start wires SDKs, then shows a loading scaffold until routing resolves.
Current behavior
main() in lib/main.dart calls WidgetsFlutterBinding.ensureInitialized(),
loads .env via flutter_dotenv (non-fatal on failure), configures RevenueCat
early from EnvConfig, sets OpenAI key if present, initializes Firebase with
DefaultFirebaseOptions, Crashlytics, NotificationService, Crisp, Quick
Actions, Mixpanel, AppsFlyer, FCM, and platform Superwall setup, then
runApp(MyApp).
Step-by-step flow
- Ensure Flutter binding.
- Load dotenv
.env. - Early
Purchases.configureusing platform RevenueCat key names. Firebase.initializeAppviafirebase_options.dart(non-null env getters).- Initialize notifications, analytics, messaging, and related services.
- Construct
MyAppwithAuthCubit/ shared preferences and run.
Failure cases
- Missing Firebase env values can throw due to
!infirebase_options.dart. - Missing optional keys log warnings; some services skip init.
Current state
Implemented. Verification: verified-from-source (main() traced).
Use caution
Do not reorder RevenueCat readiness flags without checking NotificationService and Superwall purchase controller assumptions.