init<E extends Enum> static method
Future<void>
init<E extends Enum>({
- required E defaultEnv,
- required Map<
E, String> configs, - Set<
E> ? lockedEnvironments, - bool persistSelection = true,
- @visibleForTesting EnvLoader? loader,
- @visibleForTesting EnvStore? store,
Initialises envify, loading all .env assets and restoring any
previously persisted environment selection.
defaultEnv: the environment used when no persisted selection exists.configs: maps each enum value to its asset path.lockedEnvironments: optional set of environments from which switching is forbidden. When the active environment is in this set,switchTothrowsEnvSwitchLockedExceptionand the debug panel is rendered in a locked (non-interactive) state. Defaults to no lock.persistSelection: whether the active environment is saved to and restored fromSharedPreferencesacross sessions. Whenfalse, the app always starts fromdefaultEnvand switches are not written to the store. Defaults totrue.
Must be awaited before calling any other Env method.
Implementation
static Future<void> init<E extends Enum>({
required E defaultEnv,
required Map<E, String> configs,
Set<E>? lockedEnvironments,
bool persistSelection = true,
@visibleForTesting EnvLoader? loader,
@visibleForTesting EnvStore? store,
}) async {
await EnvManager.init<E>(
defaultEnv: defaultEnv,
configs: configs,
lockedEnvironments: lockedEnvironments,
persistSelection: persistSelection,
loader: loader,
store: store,
);
}