Feature Flags
Toggle features in your app without deploying a new build. Ship code behind flags, then enable it when you're ready.
How flags work
Feature flags are fetched as part of the bootstrap snapshot when the SDK initialises. They are cached locally and evaluated entirely client-side — no network call is made when you check a flag at runtime.
Flags are updated in the background on a configurable polling interval. Changes made in the dashboard reach your users within one polling cycle — default 60 seconds.
Zero latency evaluation
Koolbase.isEnabled('flag_name') reads from the in-memory cache, and is false for a flag it doesn't know. There is no async overhead or network dependency at evaluation time.Check a flag
// Simple boolean check
final showNewUI = Koolbase.isEnabled('new_checkout');
// In a widget
Widget build(BuildContext context) {
if (Koolbase.isEnabled('new_onboarding')) {
return const NewOnboardingFlow();
}
return const LegacyOnboardingFlow();
}Percentage rollouts
From the dashboard, set a rollout percentage on any flag — e.g. 25% means only 25% of your users see the flag as enabled. Bucketing is deterministic based on a hash of the device identifier, so a user always gets the same result across sessions.
To gradually roll out a feature: start at 5%, monitor for errors, then increase to 25%, 50%, 100%. To roll back, set the flag to 0% or toggle it off.
Deterministic bucketing
Kill switch pattern
Wrap any risky feature in a flag so you can disable it instantly if something goes wrong in production — no hotfix or App Store submission required:
// Wrap risky features in a flag
Future<void> processPayment(PaymentDetails details) async {
if (!Koolbase.isEnabled('new_payment_flow')) {
return legacyProcessPayment(details); // the old flow
}
return newProcessPayment(details);
}Always provide a fallback
Creating flags in the dashboard
Navigate to your project → Feature Flags
Click New Flag and enter a key name (e.g. new_checkout)
Set the default state (enabled/disabled)
Optionally set a rollout percentage (0–100%)
Add targeting rules if needed (by device, OS, or custom traits)
Save — changes propagate within one polling cycle