main function Overview
App entry point. Boots Supabase, spawns DuTaToApp, and lazily starts Firebase + notification services in the background so the UI paints without waiting on native init.
Implementation
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// -- Supabase (must be before runApp — auth state drives routing) --
bool supabaseReady = false;
try {
await SupabaseConfig.load();
if (SupabaseConfig.isConfigured &&
SupabaseConfig.mode == InstanceMode.custom) {
await Supabase.initialize(
url: SupabaseConfig.url,
anonKey: SupabaseConfig.anonKey,
authOptions: const FlutterAuthClientOptions(
authFlowType: AuthFlowType.pkce,
),
);
supabaseReady = true;
}
} catch (e) {
dev.log('Supabase init failed: $e', name: 'main');
}
// Show the UI immediately — Firebase & notifications init in the background.
runApp(ProviderScope(child: DuTaToApp(supabaseReady: supabaseReady)));
}