import 'package:flutter/widgets.dart'; import 'app.dart'; import 'data/species_repository.dart'; import 'data/variety_repository.dart'; import 'di/injector.dart'; import 'i18n/strings.g.dart'; import 'services/auto_backup_service.dart'; import 'services/coarse_location.dart'; import 'services/locale_store.dart'; import 'services/message_store.dart'; import 'services/offer_outbox.dart'; import 'services/onboarding_store.dart'; import 'services/profile_cache.dart'; import 'services/profile_store.dart'; import 'services/social_service.dart'; import 'services/social_settings.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); // Start from the device language, then let an explicit in-app choice win — // it's the only reliable way to reach languages the OS picker doesn't offer // (e.g. Asturian). Restored after DI, since the store lives in the keystore. LocaleSettings.useDeviceLocaleSync(); await configureDependencies(); final savedLocale = await getIt().saved(); if (savedLocale != null) LocaleSettings.setLocaleSync(savedLocale); final onboarding = getIt(); runApp( TranslationProvider( child: TaneApp( repository: getIt(), species: getIt(), onboarding: onboarding, social: getIt(), socialSettings: getIt(), location: const GeolocatorCoarseLocation(), outbox: getIt(), messageStore: getIt(), profileStore: getIt(), profileCache: getIt(), showIntro: !await onboarding.introSeen(), autoBackup: getIt.isRegistered() ? getIt() : null, ), ), ); }