Skip to main content

flagnetic_flutter 0.1.0 copy "flagnetic_flutter: ^0.1.0" to clipboard
flagnetic_flutter: ^0.1.0 copied to clipboard

Flutter widgets for Flagnetic feature flags and experiments. A scope, a flag builder, listenables, the app lifecycle, a store on every platform and a Dev Tools screen.

example/example.md

Example #

A client constructed before runApp, held by a FlagneticScope, and a widget rebuilding when its flag changes. The package README covers the listenables, the store and the Dev Tools screen.

import 'package:flagnetic_flutter/flagnetic_flutter.dart';
import 'package:flutter/material.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  final store = FlutterStore();
  final client = Flagnetic.client(
    'fn_cli_…',
    baseUrl: Uri.parse('https://flags.example.com'),
    context: FlagneticContext(
      // The project declares its unit types; the SDK invents none.
      units: {'anonymous': await anonymousUnitId(store, 'anonymous')},
    ),
    options: ClientOptions(store: store),
  );
  runApp(FlagneticScope(client: client, child: const App()));
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) => MaterialApp(
    home: FlagBuilder<bool>(
      flagKey: 'checkout',
      defaultValue: false,
      builder: (context, showCheckout, detail) =>
          Text(showCheckout ? 'New checkout' : 'Basket'),
    ),
  );
}
0
likes
160
points
555
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter widgets for Flagnetic feature flags and experiments. A scope, a flag builder, listenables, the app lifecycle, a store on every platform and a Dev Tools screen.

Repository (GitHub)
View/report issues
Contributing

Topics

#feature-flags #experiments

License

Apache-2.0 (license)

Dependencies

flagnetic, flutter, path_provider, shared_preferences

More

Packages that depend on flagnetic_flutter