Keyboard Shortcuts

j / kScroll down / up
ggScroll to top
GScroll to bottom
K / /Open search
?Show this help
EscClose search / help
n / NNext / previous section
hGo to landing
dGo to docs
:Command mode — type section name

Press ? or Esc to close

Architecture

Firebase

Four Firebase products, initialized once in bootstrap(). Each is wrapped by a thin static facade so feature code never touches the SDK directly.

Initialization

lib/app/app_bootstrap.dart
Future<void> bootstrap() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
  await initializeFirebase();
  // ... DI registration
  FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
}

Future<void> initializeFirebase() async {
  AnalyticsService.init();
  CrashlyticsService.initialize();
  RemoteConfigService.initialize();
  await NotificationService.initialize();
}

The four services

ProductFacadeUsed for
AnalyticsAnalyticsServiceScreen views (called from router redirect), events
CrashlyticsCrashlyticsServiceFatal + non-fatal errors, caught in ErrorBoundary
MessagingNotificationServicePush tokens, foreground/background messages
Remote ConfigRemoteConfigServiceFeature flags, typed config values

Crashlytics wiring

FlutterError.onError and the platform dispatcher error handler are redirected to Crashlytics (skipped in dev so it doesn't pollute the console).

lib/config/utils/crashlytics/crashlytics_service.dart
void initialize() {
  if (AppConfig.isDev) return;
  FlutterError.onError = (details) {
    Crashlytics.recordError(details.exception, details.stack);
  };
  PlatformDispatcher.instance.onError = (error, stack) {
    Crashlytics.recordError(error, stack);
    return true;
  };
}

Remote Config

Keys live in remote_config_keys.dart. Access values through typed getters with a default, so a missing fetch never crashes the app.

lib/config/utils/remote_config/remote_config_service.dart
bool get showNewFeed => getBoolWithDefault('show_new_feed', false);
Convention: never import firebase_* outside config/utils/. Features call the facade, never the SDK.
sam's arch — A Pragmatic Flutter Architecture