flaggle 0.0.2 copy "flaggle: ^0.0.2" to clipboard
flaggle: ^0.0.2 copied to clipboard

Easily manage visibility of Flutter features, boosting control and customization in your app. Unlock the power of Flaggle!

example/lib/main.dart

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // Define the active feature flags
  final flaggleService = FlaggleService([
    'feature1',
    // 'feature2' is not in this list, so it will not be active
  ]);

  @override
  Widget build(BuildContext context) {
    return FlaggleProvider(
      flaggleService: flaggleService,
      child: MaterialApp(
        title: 'Flutter Flaggle Example',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Flaggle Example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(
              'You have pushed the button this many times:',
            ),
            // Wrap the feature with a Flaggle
            Flaggle(
              flag: 'feature1',
              child: Text(
                'This text is visible because feature1 is active.',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
            Flaggle(
              flag: 'feature2',
              child: Text(
                'This text is NOT visible because feature2 is not active.',
                style: Theme.of(context).textTheme.headline4,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
3
likes
160
pub points
0%
popularity

Publisher

verified publishernatanlimap.com.br

Easily manage visibility of Flutter features, boosting control and customization in your app. Unlock the power of Flaggle!

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flaggle