fluent_environment 0.0.3 fluent_environment: ^0.0.3 copied to clipboard
Package that provides a way to register your environment globally 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.3
Define environment #
class AppEnvironment extends Environment {
@override
final String name = "Development";
@override
final Color color = Colors.blue;
@override
Map<String, String> get values => {
'url': const String.fromEnvironment('URL'),
};
}
Build module #
Fluent.build([
EnvironmentModule(
environment: AppEnvironment(),
),
]);
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 = FLuent.get<EnvironmentApi>().buildEnvironmentBanner;
// Return the current environment
final environment = FLuent.get<EnvironmentApi>().getEnvironment();
return MaterialApp(
title: 'Fluent Environment Demo',
builder: (context, child) => environmentBanner(child: child!),
home: Scaffold(
body: Center(
child: Text("Environment: ${environment.type.description}"),
),
),
);
}
}