greenflags 0.1.0
greenflags: ^0.1.0 copied to clipboard
Dart/Flutter SDK for GreenFlags feature flags. Snapshot + cache reads, polling, geofence evaluation and offline persistence — evaluated at the edge.
import 'package:greenflags/greenflags.dart';
Future<void> main() async {
final flags = GreenFlagsClient(
url: 'https://app.greenflags.dev',
apiToken: const String.fromEnvironment(
'GREENFLAGS_TOKEN',
defaultValue: 'gf_your_token_here',
),
);
await flags.refresh();
for (final flag in flags.getAllFlags()) {
print('${flag.key} (${flag.type.wire}) = ${flag.value}');
}
if (flags.isEnabled('new-checkout')) {
print('new checkout is ON');
}
flags.dispose();
}