EnvBuilder class abstract

Abstract interface for environment builder functionality

Defines the contract for building and managing environment variables in Flutter applications, enabling type-safe access through generated Dart classes and encrypted storage of sensitive configuration.

Implementers

Constructors

EnvBuilder()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

capitalizeFirst(String input) String
Convert a String so that only the first character is uppercase and the rest are lowercase
createGitignoreWithEnvEntries({String path = '.gitignore', bool includeFlutterDefaults = true, bool keepExample = true}) Future<void>
Creates or updates a .gitignore file with Dart/Flutter and .env rules.
envDartFileSuffix(String fileName) String
Returns suffix for generated env Dart files, e.g., 'dev' for env.dev.dart
fileExporter(String suffix) String
Export files helper
flutterCommand(List<String> arguments, {String? path, String engine = 'flutter'}) Future<ProcessResult>
To execute Flutter command
generateAppFlavorContent(List<String> paths) String
Generate app flavor content. Help to determine the mode: development, production or staging
generateEnumClassContent(File file) String
Generate the content of the enums file Create the enum class that takes the key as value
generateEnvClassContent(String envFileName, String envClassName, File envFile) String
Generates Dart code for individual env.*.dart files
generateEnvClassName(String envFileName) String
Returns env class name for the env.* file, e.g. EnvDev, EnvProd, EnvStg
generateEnvDartFileName(String envFileName) String
Returns env Dart file name to create, e.g. env.dev.dart
getFlavor(String fileName) String
Returns the exact flavor for .env.* file, e.g: development, production, staging
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parseEnvFile(File file) Map<String, String>
Parse .env file, ignoring empty lines and comments, and handling quoted strings correctly
printUsage() → void
Display env_builder_cli usage
toCamelCase(String input) String
Here's a Dart function to convert a string like API_KEY (SCREAMING_SNAKE_CASE) into apiKey (camelCase
toString() String
A string representation of this object.
inherited
updatePubspecYaml(File pubspecFile, String path) → void
Creates or updates the 'packages/env/pubspec.yaml' with envied dependencies and plugin platforms.
updateRootPubspecWithEnvPackage(String rootPubspecPath) → void
Updates the root Flutter project's pubspec.yaml to add env package as a path dependency without duplication.
writeEnvTestFile(String path) → void
Update test/env_test.dart file

Operators

operator ==(Object other) bool
The equality operator.
inherited