EnvConfigService class
The central singleton service for runtime environment management.
Properties
- allowProdSwitch → bool
-
no setter
-
auditLog
→ Future<
List< AuditEntry> > -
no setter
-
availableEnvs
→ List<
Env> -
Returns the list of environments discovered during init.
no setter
-
current
→ ValueNotifier<
EnvConfig> -
The currently active EnvConfig, exposed as a ValueNotifier.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isProdLocked → bool
-
no setter
-
restartNeeded
→ ValueListenable<
bool> -
True if the environment/URL has changed since last init.
When true, the app should be restarted for changes to take effect.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
urlHistory
→ Future<
List< String> > -
no setter
Methods
-
acknowledgeRestart(
) → void - Call this when the app has been restarted/re-initialized to reset the restartNeeded flag and capture the current state as the new baseline.
-
clearBaseUrlOverride(
) → Future< void> -
get(
String key, {String fallback = ''}) → String -
getBool(
String key, {bool fallback = false}) → bool -
getDouble(
String key, {double fallback = 0.0}) → double -
getInt(
String key, {int fallback = 0}) → int -
getList(
String key, {String separator = ','}) → List< String> -
getOriginalUrl(
Env env) → String -
Returns the original BASE_URL for
envas defined in its.envfile. -
getUri(
String key) → Uri? -
init(
{Env defaultEnv = Env.dev, bool persistSelection = true, bool allowProdSwitch = false, bool verifyIntegrity = false, EnvStorage? storage, Future< void> onBeforeSwitch(Env from, Env to)?, void onAfterSwitch(EnvConfig config)?, List<String> ? allowedUrls, Map<Env, String> ? urls, bool autoDiscover = true, String assetDir = '', AssetBundle? bundle}) → Future<void> - Initialises the service by loading all available environment asset files.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → Future< void> -
resetForTesting(
) → void - Internal reset for unit testing only.
-
setBaseUrl(
String url) → Future< void> -
switchTo(
Env env) → Future< void> -
Switches the active environment to
env. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → EnvConfigService
-
The global singleton instance of EnvConfigService.
final