2026-02-25 18:00:02 +08:00
|
|
|
import 'dart:io';
|
|
|
|
|
|
2026-02-25 15:11:25 +08:00
|
|
|
class Env {
|
|
|
|
|
static String get apiUrl {
|
|
|
|
|
const url = String.fromEnvironment('API_URL');
|
2026-02-25 18:00:02 +08:00
|
|
|
if (url.isNotEmpty) return url;
|
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
return 'http://10.0.2.2:5775';
|
|
|
|
|
}
|
|
|
|
|
return 'http://localhost:5775';
|
2026-02-25 15:11:25 +08:00
|
|
|
}
|
2026-02-27 18:36:21 +08:00
|
|
|
|
|
|
|
|
static bool get isMockApi {
|
|
|
|
|
final fromDefine = const String.fromEnvironment('MOCK_API');
|
|
|
|
|
if (fromDefine.isNotEmpty) {
|
|
|
|
|
return fromDefine == 'true';
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2026-02-25 15:11:25 +08:00
|
|
|
}
|