패키지, 저장소 및 앱 카테고리 검색

패키지 상세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 개

소스 저장소

이 패키지를 사용하는 프로젝트