add dashboard to phone app
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
import 'dart:io';
|
||||
|
||||
class AppConstants {
|
||||
// Android emulator routes localhost as 10.0.2.2; iOS simulator uses localhost fine
|
||||
static String get baseUrl => Platform.isAndroid
|
||||
? 'http://10.0.2.2:4000/api/v1'
|
||||
: 'http://localhost:4000/api/v1';
|
||||
static const String apiBaseUrlOverride =
|
||||
String.fromEnvironment('API_BASE_URL');
|
||||
static const String developmentAndroidApiUrl = 'http://10.0.2.2:4000/api/v1';
|
||||
static const String developmentLocalApiUrl = 'http://localhost:4000/api/v1';
|
||||
|
||||
// Dev builds stay local by default. Real phones still need a LAN-reachable
|
||||
// override because their localhost is the phone itself, not the dev machine.
|
||||
static String get baseUrl {
|
||||
if (apiBaseUrlOverride.isNotEmpty) {
|
||||
return apiBaseUrlOverride;
|
||||
}
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
return developmentAndroidApiUrl;
|
||||
}
|
||||
|
||||
return developmentLocalApiUrl;
|
||||
}
|
||||
|
||||
static const String tokenKey = 'auth_token';
|
||||
static const String userTypeKey = 'user_type';
|
||||
|
||||
Reference in New Issue
Block a user