Skip to content
pubscout

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.

$ flutter pub add environment_config
Source repository

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.

Works with

Packages commonly used together with environment_config: ones it builds on, ones built on it, and its own family.