Feature Flags

Feature flags let you toggle functionality on or off remotely, and roll out features to a percentage of your users.

Checking if a flag is enabled

Use the isEnabled method to check the status of a feature flag. If the flag doesn't exist or hasn't been fetched yet, it will return the defaultValue.

dart
60">"text-white/80 font-medium">import 60">"text-white/60">'package:flowconfig_flutter/flowconfig.dart';

60">"text-white/80 font-medium">final isNewUiEnabled = 90">FlowConfig.90">isEnabled(60">"text-white/60">'new_dashboard_ui', defaultValue: false);

60">"text-white/80 font-medium">if (isNewUiEnabled) {
  60">"text-white/80 font-medium">return NewDashboardUi();
} else {
  60">"text-white/80 font-medium">return OldDashboardUi();
}

Rollout Percentages

In the FlowConfig dashboard, you can set a flag's rollout percentage from 0% to 100%.

  • 0%: Disabled for everyone.
  • 100%: Enabled for everyone.
  • 1% - 99%: Enabled for that specific percentage of unique devices.

Consistent Hashing

FlowConfig uses consistent hashing based on a persistent Device ID. This means if you set a rollout to 30%, the same 30% of users will see the feature every time they open the app. They won't randomly bounce between seeing the feature and not seeing it.

When you increase a rollout from 30% to 50%, the original 30% of users will keep the feature, and an additional 20% will get it.

Best Practices

  • Keep flags short-lived: Once a feature is 100% rolled out and stable, remove the flag from your code and the dashboard to keep things clean.
  • Always provide a default: Ensure your app functions correctly even if it can't reach the internet on its very first launch.