EnvBuilderCli class
Main implementation of the EnvBuilder interface
EnvBuilderCli provides a concrete implementation of EnvBuilder for automating environment variable management in Flutter projects.
This class integrates various components to:
- Parse environment files (.env.*)
- Generate Dart classes for type-safe access
- Create Flutter packages with encrypted environment variables
- Handle encryption/decryption of sensitive data
- Update project configurations with dependencies
- Implemented types
Constructors
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
override
-
createGitignoreWithEnvEntries(
{String path = '.gitignore', bool includeFlutterDefaults = true, bool keepExample = true}) → Future< void> -
Creates or updates a
.gitignorefile with Dart/Flutter and .env rules.override -
envDartFileSuffix(
String fileName) → String -
Returns suffix for generated env Dart files, e.g., 'dev' for env.dev.dart
override
-
fileExporter(
String suffix) → String -
Export files helper
override
-
flutterCommand(
List< String> arguments, {String? path, String engine = 'flutter'}) → Future<ProcessResult> -
To execute Flutter command
override
-
generateAppFlavorContent(
List< String> paths) → String -
Generate app flavor content.
Help to determine the mode: development, production or staging
override
-
generateEnumClassContent(
File file) → String -
Generate the content of the enums file
Create the enum class that takes the key as value
override
-
generateEnvClassContent(
String envFileName, String envClassName, File envFile) → String -
Generates Dart code for individual env.*.dart files
override
-
generateEnvClassName(
String envFileName) → String -
Returns env class name for the env.* file, e.g. EnvDev, EnvProd, EnvStg
override
-
generateEnvDartFileName(
String envFileName) → String -
Returns env Dart file name to create, e.g. env.dev.dart
override
-
getFlavor(
String fileName) → String -
Returns the exact flavor for .env.* file, e.g: development, production, staging
override
-
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
override
-
printUsage(
) → void -
Display env_builder_cli usage
override
-
toCamelCase(
String input) → String -
Here's a Dart function to convert a string like API_KEY (SCREAMING_SNAKE_CASE) into apiKey (camelCase
override
-
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.
override
-
updateRootPubspecWithEnvPackage(
String rootPubspecPath) → void -
Updates the root Flutter project's pubspec.yaml to add env package as a path dependency without duplication.
override
-
writeEnvTestFile(
String path) → void -
Update test/env_test.dart file
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited