Skip to content

fluttercandies/env2dart

Repository files navigation

Env2dart

release Apache License 2.0 open issues fork code lines

English | 简体中文

A simple way to generate dart code from a .env file.

Quick Start

  1. Install the command-line tool:
dart pub global activate env2dart
  1. Execute the following command in your project directory:
env2dart

CLI

-p, --path      Specify working directory, the CLI will look for the .env file in the current directory.
                (defaults to "")
-o, --output    Specify the output file path.
                (defaults to "lib/env.g.dart")
-a, --active    Specify the environment variables to use. For example, if -active prod is specified, the CLI will look for the .env.prod file and merge it with the .env file.
-c, --class     Specify the name for the generated class
                (defaults to "Env")
-e, --encoder   Encode value using the encoder to avoid raw strings. Allows 'base64' and 'utf8'.
-h, --help      View help options.

Example

env.g.dart

Statistics

count viewed

Sparkline

Licenses

Copyright 2023 iota9star

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.