import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'app/app.dart'; import 'core/api/api_client.dart'; import 'core/constants.dart'; import 'core/database/app_database.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); // Load the saved backend URL before building the widget tree so the API // client is initialized with the correct URL from the first request. final db = AppDatabase(); final savedUrl = await db.getSetting(AppConstants.settingBackendUrl); final backendUrl = savedUrl ?? AppConstants.defaultBackendUrl; runApp( ProviderScope( overrides: [ apiClientProvider.overrideWithValue(ApiClient(baseUrl: backendUrl)), ], child: const PrivacyMapsApp(), ), ); }