bandeira 0.2.0 copy "bandeira: ^0.2.0" to clipboard
bandeira: ^0.2.0 copied to clipboard

Official Dart/Flutter client SDK for Bandeira feature flag service

Bandeira Dart/Flutter SDK #

Official Dart client SDK for Bandeira, a self-hosted feature flag service.

Install #

dart pub add bandeira

For Flutter apps:

flutter pub add bandeira

Usage #

Option 1: Fail-fast startup with create() #

import 'package:bandeira/bandeira.dart';

Future<void> main() async {
  final client = await BandeiraClient.create(
    const BandeiraConfig(
      url: 'http://localhost:8080',
      token: 'your-client-token',
    ),
  );

  final enabled = client.isEnabled(
    'my-flag',
    const BandeiraContext(userId: 'user-123'),
  );

  if (enabled) {
    // feature is on
  }

  client.close();
}

Option 2: Construct then start() #

import 'package:bandeira/bandeira.dart';

Future<void> main() async {
  final client = BandeiraClient(
    const BandeiraConfig(
      url: 'http://localhost:8080',
      token: 'your-client-token',
    ),
  );

  await client.start();

  if (client.isEnabled('my-flag')) {
    // feature is on
  }

  client.close();
}

Notes #

  • The client polls /api/v1/flags in the background and caches flags in memory.
  • isEnabled is an in-memory lookup and does not do network I/O.
  • Call close() when done to stop polling and release resources.
0
likes
125
points
41
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Official Dart/Flutter client SDK for Bandeira feature flag service

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

http

More

Packages that depend on bandeira