environment_config
4.1.2, released 2 months ago by an unverified publisher
Environment-specific configuration and .env file generator for Flutter and Dart builds.
What it does
Generates a Dart configuration class and optional .env files based on environment configuration specified during CI/CD builds or command line execution. It supports patterns, defaults, and global environment variables.
AI-written summary of version 4.1.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to inject environment-specific variables during CI/CD builds without async file reading.
- You want to automatically generate both a Dart config class and a .env file from a YAML schema.
Skip it when
- You are using Flutter 1.17 or higher and prefer native compile-time variables over a package generator.
- You need to obfuscate or fully secure highly sensitive credentials from reverse engineering.
Strengths
- Sync reading of configuration values to decrease app start time.
- Supports custom field patterns, default values, and global environment variables.
- Can generate both Dart classes and .env files simultaneously.
Weaknesses
- Does not obfuscate or encrypt config values by default.
- Flutter developers on version 1.17+ are advised to use built-in compile-time variables instead.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Add the package as a dependency, create an environment_config.yaml file, and run the generator command via CLI.
environment_config:
path: environment_config.dart
class: EnvironmentConfig
fields:
some_key:
type: String
default: 'default_value'Alternatives
Packages that do the same job and could replace environment_config.
- build
Package for authoring build_runner compatible code generators.
87Compare - build_config
Format definition and support for parsing build.yaml configuration.
85Compare - widgetbook_annotation
Annotations for widgetbook_generator to build Flutter widgets in isolation.
80Compare - envify
Handle environment variables safely using .env files and code generation.
48Compare
Works with
Packages commonly used together with environment_config: ones it builds on, ones built on it, and its own family.
- yamlenvironment_config depends on itA Dart library for parsing YAML documents into Dart data structures.
- dart_styleenvironment_config depends on itProvides an API and CLI to format Dart source code automatically.
- argsenvironment_config depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- code_builderenvironment_config depends on itA fluent, builder-based library for generating valid Dart code programmatically.