fluent_environment 0.0.1 copy "fluent_environment: ^0.0.1" to clipboard
fluent_environment: ^0.0.1 copied to clipboard

Library that provides a way to register your environment and display it.

fluent_environment #

Package that provides a way to register your environment and display it

Getting Started #

Add dependencies #

fluent_environment: ^0.0.1

Define environment #

class AppEnvironment extends Environment {
    AppEnvironment({this.type = EnvironmentType.prod});
    
    @override
    final EnvironmentType type;

    @override
    Map<String, String> get values => {
        'url': const String.fromEnvironment('URL'),
    };
}

Build module #

Fluent.build([
    EnvironmentModule(
        AppEnvironment(type: EnvironmentType.dev),
    ),
]);

Use it #

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

    @override
    Widget build(BuildContext context) {
        // Return environment banner to display the current environment
        final environmentBanner = getApi<EnvironmentApi>().buildEnvironmentBanner;
        // Return the current environment
        final environment =  getApi<EnvironmentApi>().getEnvironment();
        
        return MaterialApp(
            title: 'Fluent Environment Demo',
            builder: (context, child) => environmentBanner(child: child!),
            home: Scaffold(
                body: Center(
                    child: Text("Environment: ${environment.type.description}"),
                ),
            ),
        );
    }
}

Example #

0
likes
0
pub points
34%
popularity

Publisher

unverified uploader

Library that provides a way to register your environment and display it.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

fluent_environment_api, flutter, mocktail

More

Packages that depend on fluent_environment