YogiBook_App/lib/config/api_config.dart
2026-01-17 17:36:07 +01:00

41 lines
1.2 KiB
Dart

import 'package:flutter/foundation.dart';
class ApiConfig {
/// Metti true quando vuoi puntare al server live
static const bool useLive = true;
/// Dominio produzione
static const String liveHost = 'app.yogiboook.com';
// Host handling DEV:
// - Web: localhost
// - Android emulator: 10.0.2.2 (maps to host machine)
static String get _devHost {
if (kIsWeb) return 'localhost';
if (defaultTargetPlatform == TargetPlatform.android) return '10.0.2.2';
return 'localhost';
}
static String get host => useLive ? liveHost : _devHost;
static String get scheme => useLive ? 'https' : 'http';
/// Laravel/Vanguard API (login, password remind, ecc)
/// DEV: http://10.0.2.2/yogiboook/public/api
/// LIVE: https://app.yogiboook.com/public/api
static String get laravelApiBase {
if (useLive) return '$scheme://$host/public/api';
return '$scheme://$host/yogiboook/public/api';
}
/// PHP custom APIs
/// DEV: http://10.0.2.2/yogiboook/public/userarea/api
/// LIVE: https://app.yogiboook.com/public/userarea/api
static String get phpApiBase {
if (useLive) return '$scheme://$host/public/userarea/api';
return '$scheme://$host/yogiboook/public/userarea/api';
}
static const String deviceName = 'FlutterApp';
}