43 lines
968 B
Dart
Executable File
43 lines
968 B
Dart
Executable File
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
|
|
|
import '../home.dart';
|
|
|
|
class Environment {
|
|
static String get fileName {
|
|
const String env =
|
|
String.fromEnvironment('ENV', defaultValue: 'development');
|
|
switch (env) {
|
|
case 'test':
|
|
return '.env.test';
|
|
case 'uat':
|
|
return '.env.uat';
|
|
case 'production':
|
|
return '.env.production';
|
|
default:
|
|
return '.env.development';
|
|
}
|
|
}
|
|
|
|
static String get apiUrl {
|
|
return dotenv.env['API_URL'] ?? 'API_URL not found!';
|
|
}
|
|
|
|
static String get apiUrlPost {
|
|
return dotenv.env['API_URL_POST'] ?? 'API_URL not found!';
|
|
}
|
|
|
|
static String get baseHref {
|
|
return dotenv.env['BASE_HREF'] ?? 'BASE_HREF not found!';
|
|
}
|
|
|
|
static String get env {
|
|
return dotenv.env['ENV'] ?? 'ENV not found!';
|
|
}
|
|
}
|
|
|
|
Future<void> main() async {
|
|
await dotenv.load(fileName: Environment.fileName);
|
|
runApp(MyApp());
|
|
}
|