applyEnvironment static method
void
applyEnvironment(
- dynamic environment
Apply predefined environment configuration
Type-safe way to configure Zenify for different environments.
Example:
// Type-safe (recommended)
ZenConfig.applyEnvironment(ZenEnvironment.production);
// String-based (legacy support)
ZenConfig.applyEnvironment('production');
Implementation
static void applyEnvironment(dynamic environment) {
final ZenEnvironment env;
if (environment is ZenEnvironment) {
env = environment;
} else if (environment is String) {
env = ZenEnvironment.fromString(environment);
} else {
throw ArgumentError(
'Environment must be ZenEnvironment or String, got ${environment.runtimeType}');
}
switch (env) {
case ZenEnvironment.production:
_applyProductionConfig();
break;
case ZenEnvironment.productionVerbose:
_applyProductionVerboseConfig();
break;
case ZenEnvironment.staging:
_applyStagingConfig();
break;
case ZenEnvironment.development:
_applyDevelopmentConfig();
break;
case ZenEnvironment.debug:
_applyDebugConfig();
break;
case ZenEnvironment.trace:
_applyTraceConfig();
break;
case ZenEnvironment.test:
_applyTestConfig();
break;
}
}