PackageTrack
Sign in Get early access

flutter_dotenv

Easily configure any flutter application with global variables using a `.env` file.

6.0.1 1000K downloads/mo #50 most downloaded on pub.dev java-james/flutter_dotenv

What this package is like to depend on

Last release 4 months ago

21 Apr 2026

Release timing varies

gaps range from 9 days to 1.8 years

Some releases are documented

notes for 9 of 17 stable releases

Nothing withdrawn

no release was ever pulled

8 years old

22 releases · first in 2018

1 release in the last 12 months

see the full history below

Release timeline

22 releases · Dec 2018 to Apr 2026
2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 22
  1. 6.0.1 21 Apr 2026
    Release notes

    chore(release): publish 6.0.1

    Open source →
    Release notes
    • [fix] isEveryDefined() now throws NotInitializedError before load(), consistent with all other read APIs
    • [fix] Replace assert() with explicit if/throw in getInt(), getDouble(), and getBool() so null-safety checks are enforced in release builds
    • Error messages now include the variable name for easier debugging
    • [fix] load(isOptional: true) no longer discards successfully loaded base file when an override file is missing or empty (fixes #70, #93, #101, #125)
    • [fix] clean() now resets isInitialized to false, so accessing env after clean() correctly throws NotInitializedError
    • [fix] Error classes (NotInitializedError, FileNotFoundError, EmptyEnvFileError) now include informative messages in toString() instead of the unhelpful Instance of 'ClassName' (fixes #72, #127; improves diagnostics for #59, #89)
    • FileNotFoundError and EmptyEnvFileError now carry the filename when available

    Note on error message improvements

    NotInitializedError, FileNotFoundError, and EmptyEnvFileError now override toString() with actionable messages (e.g., FileNotFoundError: Environment file ".env" not found. Ensure the file exists and is listed under assets in pubspec.yaml.). This is not a breaking change — the class names and hierarchy are unchanged, so existing on FileNotFoundError catch clauses continue to work. FileNotFoundError now accepts an optional positional filename parameter, and EmptyEnvFileError accepts an optional named filename parameter; both default to null for backward compatibility.

    Note on release-build behavior change

    In debug mode, behavior is unchanged — AssertionError was thrown before, AssertionError is thrown now.

    In release mode, calling getInt(), getDouble(), or getBool() with a missing variable and no fallback previously threw a TypeError (from the null-check operator !) because assert() was stripped. It now correctly throws AssertionError with a descriptive message. If your release-mode code catches on TypeError around these methods, update it to catch on AssertionError (or on Error) instead.

    Breaking change: clean() now resets initialization state

    Previously, calling clean() only cleared the env map but left isInitialized == true. Now it also sets isInitialized = false. Code that calls clean() and then immediately accesses dotenv.env without reloading will now throw NotInitializedError. The fix is to call load() or loadFromString() again after clean().

    Open source →
  2. 6.0.0 20 Aug 2025
    Release notes

    chore(release): publish 6.0.0

    Open source →
    Release notes
    • [feat] Allow passing in override .env files on init
    • [feat] Load .env from a passed in string

    Breaking changes

    • Renamed: testLoadloadFromString
      The method has been renamed to better reflect that it can be used outside of test environments.
      ⚠️ Update your code to call loadFromString() instead of testLoad().

    • Behavior change: Empty file handling with isOptional = true
      Previously, if the env file was empty and isOptional was true, the method would throw.
      Now, in this case, it no longer throws and simply returns an empty env.

    • Supported SDK range change: Dropped support for the pre release 2.12.0-0. Now supports 2.12.0 onwards.

    Open source →
  3. 6.0.0-rc.3 20 Aug 2025 pre-release

    Nothing published for this version

  4. 6.0.0-rc.2 20 Aug 2025 pre-release

    Nothing published for this version

  5. 6.0.0-rc.1 20 Aug 2025 pre-release

    Nothing published for this version

  6. 5.2.1 14 Oct 2024
    Release notes

    chore(release): publish 5.2.1 (#117)

    Open source →
    Release notes
    • [chore] Update readme with security info and new usage examples
    Open source →
  7. 5.2.0 14 Oct 2024
    Release notes

    chore(release): publish 5.2.0 (#116)

    Open source →
    Release notes
    • [new] Get variables as int, double and bool
    • [deps] Upgrade dart sdk constraints to >=2.12.0-0 <4.0.0
    • [new] Export error classes
    Open source →
  8. 5.1.0 01 Jun 2023
    Release notes
    • [new] Add isOptional init param to prevent throwing if env file is not found
    • [new] variable name in error message
    Open source →
  9. 5.0.2 12 Aug 2021

    Nothing published for this version

  10. 5.0.1 11 Aug 2021
    Release notes
    • [fix] Change testLoad() to be synchronous
    • [new] Add get() and maybeGet() methods for getting values with a fallback
    Open source →
  11. 5.0.0 28 May 2021
    Release notes
    • [BREAKING] Wrap dotenv.dart methods within a class
    • [fix] Updated documentation to reflect changes and improve clarity

    Upgrading from 4.0.x

    • Access dotenv methods from the DotEnv class instead of globally.
    • Prepend dotenv to all dotenv method calls: e,g, load() to dotenv.load().

    4.0.0-nullsafety.1

    • [fix] Remove lookbehind regex to support safari browser
    Open source →
  12. 4.0.0-nullsafety.1 27 Apr 2021 pre-release

    Nothing published for this version

  13. 4.0.0-nullsafety.0 04 Mar 2021 pre-release
    Release notes
    • [BREAKING] Opt into null-safety
    • [deps] Upgrade dart sdk constraints to >=2.12.0-0 <3.0.0
    • [new] Allow for escape of $ ' " and \n characters
    • [fix] Ensure swallow function only removes leading 'export' keyword
    • [fix] Retain spaces within single or double quotes
    • [fix] Allow for comments after matching end quotes
    • [new] Migrate to null safety
    • [new] Create unit test cases for parse

    3.1.0

    • [new] Allow merging with a custom map on load

    3.0.2

    • [chore] Format code with dart fmt

    3.0.1

    • [docs] Use secure links
    Open source →
  14. 3.1.0 18 Jan 2021

    Nothing published for this version

  15. 3.0.2 15 Jan 2021

    Nothing published for this version

  16. 3.0.1 14 Jan 2021

    Nothing published for this version

  17. 3.0.0 14 Jan 2021
    Release notes
    • [new] Merge with Platform.Environment
    • [new] Throw precise errors
    • [new] Access via functions
    • [new] Improved Parsing
    • [docs] Example project

    2.1.0

    • [new] Support '=' sign in value

    2.0.3

    • [fix] Warning when using with flutter_test

    2.0.2

    • [fix] Flutter 1.9.5 compatibility ensure binding was initialized

    2.0.1

    • [docs] tweak app description
    • [fix] increase meta version range
    Open source →
  18. 2.1.0 27 Nov 2019

    Nothing published for this version

  19. 2.0.3 10 Sep 2019

    Nothing published for this version

  20. 2.0.2 01 Sep 2019

    Nothing published for this version

  21. 2.0.1 12 Dec 2018

    Nothing published for this version

  22. 2.0.0 12 Dec 2018
    Release notes
    • Flutter compatible
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive