app_debugger_feature_flag Pro
Feature flag spoofer sub-brick for
app_debugger. Adds a Feature Flags tab to the debugger panel that lets developers override flag evaluations at runtime without touching the real provider chain. Automatically swapped to a no-op stub in release builds.
Version: 1.0.0
Variables
This brick has no generation-time variables. The spoofer delegate works with any FeatureFlagProvider implementation at runtime.
Prerequisites
app_debuggerbrick must be installed first.- A
feature_flag_implpackage must be configured in your app.
Usage
Interactive
archipelago generate app_debugger_feature_flagNon-interactive (CI)
archipelago generate app_debugger_feature_flag --config my_config.jsonGenerated Structure
features/
└── app_debugger_feature_flag/
├── app_debugger_feature_flag_api/
│ └── lib/src/
├── app_debugger_feature_flag/
│ └── lib/src/
└── app_debugger_feature_flag_noop/
└── lib/src/Required Setup After Generation
Wire the delegate into your FeatureFlag SDK's delegate chain (in post_launch_initializer.dart or your DI setup):
final spoofer = getIt<FeatureFlagSpooferSDK>();
if (spoofer.delegate != null) {
featureFlagSdk.addDelegate(spoofer.delegate!);
}The null guard makes this safe in release builds where the noop stub returns null for delegate.
Delegate Chain Semantics
FeatureFlagDelegate is an override hook that runs before the real provider chain. Multiple delegates can be chained; the aggregator iterates them and stops at the first non-null result.
The spoofer installs itself at the front of the delegate chain so its overrides always take precedence.
FlagOverride Model
| Field | Type | Description |
|---|---|---|
flagKey | String | The flag key to override |
value | FeatureFlagResult | The result returned when the override is active |
enabled | bool (default: true) | Toggle the override on/off without removing it |
Setting enabled: false suspends the override without deleting it — useful for temporarily restoring real-provider behaviour for a specific flag during testing.
How It Works
FeatureFlagSpooferSDKImplconstructs aFeatureFlagSpooferDelegatebacked by a sharedMap<String, FlagOverride>and registers aFeatureFlagSpooferPagewithDebuggerPanelPageRegistry.DebuggerPanelreadsDebuggerPanelPageRegistry.instance.pagesand appends extra tabs — no import ofapp_debugger_feature_flagrequired.FeatureFlagSpooferDelegate.evaluatechecks the override map for the flag key — if an enabled override exists, returnsoverride.value; otherwise returnsnull, deferring to the next delegate.build_prepare.yamlswapsapp_debugger_feature_flag→app_debugger_feature_flag_noopfor release builds.