27 lines
932 B
Dart
27 lines
932 B
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 {
|
|
if (isDevelopment) {
|
|
return 'https://api.dev.your-app.com';
|
|
} else {
|
|
return 'https://api.prod.your-app.com';
|
|
}
|
|
}
|
|
|
|
// کلیدهای حساس را به این شکل مدیریت کنید
|
|
static String get apiKey {
|
|
if (isDevelopment) {
|
|
return 'dev-api-key-123';
|
|
} else {
|
|
return 'prod-api-key-456';
|
|
}
|
|
}
|
|
}
|