パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v4.2.0

dotenv

.env ファイルから環境変数を読み込みます。

AndroidiOSmacOSWindowsLinux
30日間ダウンロード
15万
いいね数
154
Pub ポイント
135

パッケージをインストール

flutter pub add dotenv

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

dotenv パッケージは、Flutter アプリケーションが `.env` ファイルから環境変数を読み込むことを可能にし、異なる環境間での設定管理を簡素化します。このパッケージはファイルからキーと値のペアを読み取り、アプリ内で利用可能にします。ハードコードされた資格情報の回避によりセキュリティが向上します。API キー、URL、およびその他の機密性の高いまたは環境固有の設定を管理する場合に特に役立ちます。このパッケージは、Android、iOS、macOS、Windows、Linux を含むすべての主要プラットフォームをサポートしています。

用途

  • API キーを安全に管理する
  • 環境ごとのアプリ動作の設定
  • 機密資格情報の保存
  • マルチ環境設定の有効化
  • ハードコードされた設定値を避ける

主な機能

  • .env ファイルから変数を読み込む
  • プラットフォームに依存しない設定をサポート
  • シンプルなキー値対の構文
  • Flutterアプリへの簡単な統合
  • シークレットの安全な取り扱い

適している対象

  • 開発およびステージング環境
  • 複数の構成プロファイルを必要とするアプリ
  • 共有構成を管理するチーム
  • 厳格なセキュリティ要件を持つプロジェクト
  • 環境ファイルを使用した CI/CD パイプライン

注意事項

  • .env ファイルをバージョン管理にコミットしないでください
  • .env が .gitignore に追加されていることを確認してください
  • 変数は起動時にのみ読み込まれます
  • シンプルな文字列値に限定
  • 複雑なデータ構造には適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

dotenv

Load environment variables at runtime from a .env file.

Pub Version Build Status Documentation style: tidy

about

Deploying applications should be simple. This implies constraints:

The twelve-factor app stores config in environment variables (often shortened to env vars or env). Env vars are easy to change between deploys without changing any code... they are a language- and OS-agnostic standard.

An environment is the set of variables known to a process (say, PATH, PORT, ...). It is desirable to mimic the production environment during development (testing, staging, ...) by reading these values from a file.

This library parses that file and optionally merges its values with the built-in Platform.environment map.

usage

See documentation and examples.

cli

Get the latest:

$ dart pub global activate dotenv

Run:

$ dart pub global run dotenv:new  # create a .env file and add it to .gitignore
$ dart pub global run dotenv      # load the file and print only the file environment variables to stdout
$ dart pub global run dotenv -p   # load the file and print all the environment variables to stdout
discussion

Use the issue tracker for bug reports and feature requests.

Pull requests gleefully considered.

prior art
license: MIT

カテゴリー

依存関係

依存関係一覧 2 件

ソースリポジトリ

このパッケージを使用しているプロジェクト