import 'dart:io' show Platform; /// Backend base URL, without a trailing slash and without `/api/v1`. /// /// Override at build/run time, e.g.: /// flutter run --dart-define=API_BASE_URL=http://192.168.1.10:8000 /// /// Without an override we guess a sane per-platform default for local dev: /// the Android emulator can't reach the host via `localhost` (it has its own /// loopback), so it needs the special `10.0.2.2` alias instead. class ApiConfig { static const _override = String.fromEnvironment('API_BASE_URL'); static String get baseUrl { if (_override.isNotEmpty) return _override; if (!Platform.isAndroid) return 'http://localhost:8000'; return 'http://10.0.2.2:8000'; } static String get apiV1Url => '$baseUrl/api/v1'; }