Files
tm_app/lib/core/config/app_config.dart
T
amirrezaghabeli 81d01d53ae login added
2025-08-16 16:11:57 +03:30

42 lines
1.6 KiB
Dart

class AppConfig {
// این فلگ نشان می‌دهد که آیا برنامه در حالت Development است یا خیر.
// می‌توانید این مقدار را با استفاده از environment variables در زمان بیلد تغییر دهید.
static const bool isDevelopment = true;
static const Duration connectTimeout = Duration(seconds: 15);
static const Duration receiveTimeout = Duration(seconds: 15);
// این متد بر اساس محیط فعال، URL مناسب را برمی‌گرداند.
static String get apiBaseUrl {
return 'http://10.0.2.2:8081';
// if (isDevelopment) {
// // Handle different platforms for local development
// if (kIsWeb) {
// // For web, use localhost
// return 'http://localhost:8081';
// } else if (Platform.isAndroid) {
// // For Android emulator, use 10.0.2.2 (special IP for host machine)
// return 'http://10.0.2.2:8081';
// } else if (Platform.isIOS) {
// // For iOS simulator, use localhost
// return 'http://localhost:8081';
// } else {
// // For other platforms (desktop), use localhost
// return 'http://localhost:8081';
// }
// } else {
// // Production URL - replace with your actual production server
// return 'https://your-production-server.com';
// }
}
// کلیدهای حساس را به این شکل مدیریت کنید
static String get apiKey {
if (isDevelopment) {
return 'dev-api-key-123';
} else {
return 'prod-api-key-456';
}
}
}