Feature Flag Key Constants
Component Detail
Description
A centralized constants file defining all valid feature flag keys as typed string constants. Prevents magic strings scattered across the codebase and provides a single source of truth for flag names that mirrors the keys stored in the Supabase organization_configs table.
feature-flag-constants
Summaries
The Feature Flag Key Constants file establishes a single, auditable contract between the mobile application and the organization configuration database for every feature entitlement the product supports. By centralizing flag names, the business gains a clear, version-controlled record of which capabilities exist, which customer segments they apply to, and when they were introduced—providing direct input into product roadmap reporting, contract scoping, and compliance documentation. Eliminating scattered magic strings reduces the risk of silent misconfiguration errors where a typo in a flag name causes a feature to be permanently disabled for a customer, protecting both revenue and customer relationships. Its shared nature means every team member consults the same source of truth.
Feature Flag Key Constants is the lowest-risk, lowest-complexity deliverable in the feature flag system and should be one of the first tasks completed, as all other components and every feature consuming flags depends on it. It requires no dependencies, no testing beyond a simple compile-time check, and no deployment coordination. However, it is a high-communication artifact: product, engineering, and backend teams must agree on the exact string values before the file is written, since any mismatch with the Supabase `organization_configs` schema will cause silent flag misses at runtime.
Maintain a review step where the constants file is cross-checked against the database schema before each release to catch drift introduced by backend changes.
FeatureFlags is a Dart abstract class or extension type with only static const String fields, making it tree-shakeable and zero-cost at runtime. Each constant mirrors the exact key stored in the Supabase `organization_configs.features` JSONB column—any drift between this file and the database schema causes `isEnabled(flagKey)` to silently return false. The `all()` factory returns a `List
This file should be the single import point for flag keys across the codebase—lint rules or a custom analysis plugin can enforce that no raw string literals appear in `isEnabled()` call sites outside this file.
Responsibilities
- Define compile-time constants for every supported feature flag key
- Group flag constants by domain area (travel, courses, gamification, etc.)
- Provide documentation comments describing which organizations each flag applies to
Interfaces
FeatureFlags.travelReimbursement
FeatureFlags.courseAdministration
FeatureFlags.certification
FeatureFlags.encryptedAssignmentDispatch
FeatureFlags.gamification
FeatureFlags.all() → List<String>
Related Data Entities (1)
Data entities managed by this component