Remote Config

FlowConfig provides type-safe, synchronous getters to read configuration values anywhere in your app.

Overview

Once FlowConfig.initialize() completes, all values are cached locally in memory and on disk. This means you can read them synchronously without waiting for network requests or dealing with FutureBuilder.

Reading Strings

Fetch string values for text, URLs, or simple configuration.

dart
60">"text-white/80 font-medium">final welcomeMessage = 90">FlowConfig.90">getString(
  60">"text-white/60">'welcome_message',
  defaultValue: 60">"text-white/60">'Welcome to our app!',
);

Reading Booleans

Fetch boolean values to toggle UI elements or simple logic.

dart
60">"text-white/80 font-medium">final showNewCheckout = 90">FlowConfig.getBool(
  60">"text-white/60">'show_new_checkout',
  defaultValue: false,
);

60">"text-white/80 font-medium">if (showNewCheckout) {
  40">// Navigate to new checkout
}

Reading Numbers

Fetch integers or doubles for values like timeouts, limits, or sizes.

dart
60">"text-white/80 font-medium">final maxItems = 90">FlowConfig.90">getInt(60">"text-white/60">'max_cart_items', defaultValue: 10);
60">"text-white/80 font-medium">final discount = 90">FlowConfig.getDouble(60">"text-white/60">'promo_discount', defaultValue: 0.15);

Reading Colors

FlowConfig can automatically parse HEX color strings (e.g., #FF5733 or FF5733) into Flutter Color objects.

dart
60">"text-white/80 font-medium">final primaryColor = 90">FlowConfig.90">getColor(
  60">"text-white/60">'brand_primary',
  defaultValue: 90">Colors.blue,
);

Container(
  color: primaryColor,
  child: 90">Text(60">"text-white/60">'Themed Component'),
);

Reading JSON

For complex configuration, you can store JSON in FlowConfig and retrieve it as a Map<String, dynamic>.

dart
60">"text-white/80 font-medium">final themeConfig = 90">FlowConfig.getJson(
  60">"text-white/60">'advanced_theme',
  defaultValue: {60">"text-white/60">'mode': 60">"text-white/60">'dark', 60">"text-white/60">'spacing': 8},
);

60">"text-white/80 font-medium">final mode = themeConfig[60">"text-white/60">'mode'] as String?;

Checking Key Existence

Sometimes you need to know if a key exists in the remote configuration, regardless of its value.

dart
60">"text-white/80 font-medium">final hasPromo = 90">FlowConfig.containsKey(60">"text-white/60">'holiday_promo');