flutter_env_switch 1.1.4
flutter_env_switch: ^1.1.4 copied to clipboard
Type-safe runtime environment switcher for Flutter. Load .env files, switch configs at runtime, lock envs, and debug with a built-in panel.
1.1.4 #
AppRestarter.onRestart— new optionalFuture<void> Function()?callback invoked before the widget tree rebuilds. Use it to re-initialise services (Sentry, Dio, etc.) that were set up inmain()and need to pick up the new environment values.AppRestarter.builder— newWidgetBuilder?alternative tochild. The builder is re-evaluated on every restart, allowing dynamic re-creation of widgets that hold references to re-created objects (e.g.GoRouter). Exactly one ofchildorbuildermust be provided.EnvSwitcher.enableInRelease— newboolparameter (defaulttrue). Controls whether the debug panel gesture is active in release builds. Set tofalseto restrict the panel to debug/profile builds only (the behaviour of prior versions).EnvSwitcher.enableddefault changed from!kReleaseModetotrue— the panel now works in release mode by default. Callers that need the old behaviour should setenableInRelease: false.
1.1.3 #
- Updated
CHANGELOG.mdto include entries for versions1.1.2and1.1.3.
1.1.2 #
- Added
CHANGELOG.mdentry for version1.1.1. - Replaced deprecated
Color.withOpacitycalls withColor.withValues(alpha:)across all UI files to resolve pana static-analysis warnings. - Corrected
repositoryURL inpubspec.yamltohttps://github.com/lazytechsavvy/flutter_env_switch. - Bumped minimum Flutter SDK to
>=3.27.0and Dart SDK to>=3.3.0to ensureColor.withValuesis available in the target environment.
1.1.1 #
- Fixed deprecated
Color.withOpacitycalls — replaced withColor.withValues(alpha:)throughout the UI layer to eliminate pana static-analysis warnings. - Bumped minimum Flutter SDK to
>=3.27.0and Dart SDK to>=3.3.0to align with theColor.withValuesAPI availability. - Updated
repositoryURL to the correct GitHub handle.
1.1.0 #
- Tap-count trigger —
EnvSwitchergainstriggerMode(EnvTriggerMode.longPress|EnvTriggerMode.tapCount),tapCount(default 5), andtapWindowMs(default 3000) for the industry-standard hidden-panel gesture. onSwitchedcallback —EnvSwitcherandshowEnvDebugPanelnow accept an optionalVoidCallback? onSwitchedfired after each successful environment switch.- In-panel key browser — the debug panel includes a collapsible "View loaded keys"
section that enumerates all key/value pairs for the active environment. Sensitive keys
(containing
KEY,SECRET,TOKEN, etc.) are masked by default with an eye-toggle. All values can be copied to clipboard. EnvBadge<E>— new overlay widget that renders a persistent environment indicator badge in a corner of its child, reacting automatically to runtime switches.Env.currentEnvData— new static getter exposing all key/value pairs for the current environment as an unmodifiableMap<String, String>.EnvManager.currentEnvData— same, on the typed singleton.
1.0.0 #
- Locked environments — new
lockedEnvironmentsparameter onEnv.initprevents switching away from sensitive environments (e.g. production) at runtime. Env.isLockedstatic getter andEnvManager.isCurrentLockedfor programmatic checks.EnvSwitchLockedExceptiontyped exception thrown when a locked-env switch is attempted.- Debug panel renders a
LOCKEDbadge and disables all environment tiles when locked. - Restart-after-switch toggle is hidden in the panel when the environment is locked.
0.1.0 #
- Initial release.
- Multi-.env file loading from Flutter asset bundle.
- Enum-driven, type-safe environment switching.
- Runtime switching with
SharedPreferencespersistence. - Gesture-triggered debug panel (long-press bottom sheet).
AppRestarterfor soft app restart viaUniqueKey.EnvSwitcherwidget wrapper — automatically disabled in release mode.- Optional
EnvDioInterceptorfor Dio base URL injection. ValueNotifier-based reactive current-environment broadcasting.- Full unit and widget test suite.