forked from eatvio/eatvio_app
17 lines
586 B
Dart
17 lines
586 B
Dart
import 'package:eatvio_app/core/app_config.dart';
|
|
import 'package:eatvio_app/core/locator_service.dart';
|
|
import 'package:eatvio_app/core/prefs.dart';
|
|
import 'package:eatvio_app/core/prefs_keys.dart';
|
|
|
|
/// Подставляет сохранённый base URL до создания HTTP-клиента.
|
|
void applyCachedBaseUrl() {
|
|
if (!sl.isRegistered<Prefs>() || !sl.isRegistered<AppConfig>()) {
|
|
return;
|
|
}
|
|
final cached = sl<Prefs>().getString(PrefsKeys.customBaseUrl)?.trim();
|
|
if (cached == null || cached.isEmpty) {
|
|
return;
|
|
}
|
|
sl<AppConfig>().setBaseUrl(cached);
|
|
}
|