flipt 0.0.1 copy "flipt: ^0.0.1" to clipboard
flipt: ^0.0.1 copied to clipboard

A lightweight HTTP client for consuming Flipt feature flag snapshots using `description` as values.

example/flipt_example.dart

import 'package:flipt/flipt.dart';

Future<void> main() async {
  final flipt = Flipt(
    host: 'feature-flags.example.com',
    token: 'your-api-token',
    namespace: 'production',
    environment: 'mobile-app',
    context: const {'app_version': '2.5.0', 'platform': 'ios'},
    defaultValues: {
      'new_checkout_flow': false,
      'max_recommendations': 6,
      'api_base_url': 'https://api.example.com',
      'checkout_thresholds': const <String, Object>{
        'caution': 0.6,
        'critical': 0.9,
      },
      'supported_locales': const <Object>['en', 'vi'],
    },
    storage: FliptMemoryStorage(),
    fetchInterval: const Duration(minutes: 15),
    timeout: const Duration(seconds: 5),
    isDebug: true,
  );

  try {
    await flipt.ensureInitialized;

    final isCheckoutEnabled = flipt.getBool(
      'new_checkout_flow',
      defaultValue: false,
    );
    final recommendationLimit = flipt.getInt(
      'max_recommendations',
      defaultValue: 3,
    );
    final apiUrl = flipt.getString('api_base_url');
    final thresholds = flipt.getMap<double>('checkout_thresholds');
    final locales = flipt.getList<String>('supported_locales');

    print('Checkout enabled: $isCheckoutEnabled');
    print('Recommendation limit: $recommendationLimit');
    print('API base URL: $apiUrl');
    print('Checkout thresholds: $thresholds');
    print('Supported locales: $locales');
  } finally {
    flipt.dispose();
  }
}
0
likes
0
points
35
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight HTTP client for consuming Flipt feature flag snapshots using `description` as values.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on flipt