AppEnv.fromDartDefines constructor
AppEnv.fromDartDefines()
Implementation
factory AppEnv.fromDartDefines() {
const envString = String.fromEnvironment('ENV', defaultValue: 'dev');
final env = AppEnvironment.fromString(envString);
return switch (env) {
AppEnvironment.dev => AppEnv(
environment: AppEnvironment.dev,
baseUrl: 'https://dev-api.example.com',
apiKey: 'dev_key_123',
),
AppEnvironment.stg => AppEnv(
environment: AppEnvironment.stg,
baseUrl: 'https://stg-api.example.com',
apiKey: 'stg_key_456',
),
AppEnvironment.prod => AppEnv(
environment: AppEnvironment.prod,
baseUrl: 'https://api.example.com',
apiKey: 'prod_key_789',
),
};
}