EnvConfigDisplay class
A Flutter widget that dynamically displays environment configuration information based on changes in the current environment.
This widget is particularly useful for scenarios where your application's UI needs to adapt to different environment configurations (dev, staging, prod). It utilizes a ValueListenableBuilder to listen for updates to the EnvironmentConfig provided by the EnvironmentManager class.
By providing a builder function, you can define how the UI should be constructed based on the current environment settings. This allows for flexible and dynamic UI updates based on configuration changes.
Example usage:
EnvConfigDisplay(
builder: (context, config) {
return Column(
children: [
Text('Environment: ${config.name}'),
Text('API URL: ${config.api?.baseUrl}'),
],
);
},
);
In this example, the builder function displays the current environment name
and the base URL retrieved from the api section of the configuration.
You can customize the builder function to display any relevant information
and create a dynamic UI based on the configuration data.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- EnvConfigDisplay
Constructors
- EnvConfigDisplay({Key? key, required Widget builder(BuildContext context, EnvironmentConfig config)})
-
Creates an EnvConfigDisplay widget.
const
Properties
- builder → Widget Function(BuildContext context, EnvironmentConfig config)
-
A builder function that receives the current BuildContext, the
EnvironmentConfig object, and a dummy argument (
_) provided by ValueListenableBuilder. You can use theconfigobject to access environment-specific settings and build the UI accordingly.final - hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited