Skip to main content

zenmanage 1.0.0 copy "zenmanage: ^1.0.0" to clipboard
zenmanage: ^1.0.0 copied to clipboard

Official Dart/Flutter SDK for Zenmanage feature flags with local evaluation. Control feature rollouts, A/B test, and manage configurations without deploying code.

example/lib/main.dart

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

void main() {
  WidgetsFlutterBinding.ensureInitialized();

  final zenmanage = Zenmanage(
    ConfigBuilder.create()
        .withEnvironmentToken('mob_your_environment_token_here')
        .withCache(InMemoryCache())
        .build(),
  );

  runApp(MyApp(zenmanage: zenmanage));
}

class MyApp extends StatelessWidget {
  const MyApp({super.key, required this.zenmanage});

  final Zenmanage zenmanage;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Zenmanage Flutter Example',
      home: ZenmanageInitializer(
        zenmanage: zenmanage,
        loadingBuilder: (_) => const Scaffold(
          body: Center(child: CircularProgressIndicator()),
        ),
        errorBuilder: (_, error, __) => Scaffold(
          body: Center(
            child: Text('Initialization failed: $error'),
          ),
        ),
        child: const HomePage(),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    final userContext = Context.user(
      id: 'user_123',
      name: 'Taylor',
      attributes: const {'plan': 'premium'},
    );

    return Scaffold(
      appBar: AppBar(title: const Text('Zenmanage Flutter Example')),
      body: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const Text('App-wide SDK initialization + widget-level flags'),
            const SizedBox(height: 16),
            ZenmanageFlagBuilder(
              flagKey: 'new-dashboard',
              defaultValue: false,
              context: userContext,
              builder: (context, snapshot) {
                if (snapshot.connectionState != ConnectionState.done) {
                  return const Text('Loading new-dashboard...');
                }
                if (snapshot.hasError) {
                  return Text('Error: ${snapshot.error}');
                }

                final enabled = snapshot.data?.isEnabled() ?? false;
                return Text(
                  enabled
                      ? 'new-dashboard is enabled'
                      : 'new-dashboard is disabled',
                );
              },
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
160
points
--
downloads

Documentation

Documentation
API reference

Publisher

verified publisherzenmanage.com

Weekly Downloads

Official Dart/Flutter SDK for Zenmanage feature flags with local evaluation. Control feature rollouts, A/B test, and manage configurations without deploying code.

Repository (GitHub)
View/report issues
Contributing

Topics

#feature-flags #feature-toggles #ab-testing #experiments #remote-config

License

MIT (license)

Dependencies

flutter, http, shared_preferences

More

Packages that depend on zenmanage