[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().
[feat] Allow passing in override .env files on init
[feat] Load .env from a passed in string
Breaking changes
Renamed: testLoad → loadFromString
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.
Configuration
📅Schedule: (UTC)
Branch creation
At any time (no schedule defined)
Automerge
At any time (no schedule defined)
🚦Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕Ignore: Close this PR and you won't be reminded about this update again.
If you want to rebase/retry this PR, check this box
This PR contains the following updates:
| Package | Type | Update | Change |
|---|---|---|---|
| [flutter_dotenv](https://github.com/java-james/flutter_dotenv) | dependencies | major | `^5.2.1` → `^6.0.0` |
---
> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/3) for more information.
---
### Release Notes
<details>
<summary>java-james/flutter_dotenv (flutter_dotenv)</summary>
### [`v6.0.1`](https://github.com/java-james/flutter_dotenv/blob/HEAD/CHANGELOG.md#601)
[Compare Source](https://github.com/java-james/flutter_dotenv/compare/6.0.0...6.0.1)
- \[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](https://github.com/java-james/flutter_dotenv/issues/70), [#​93](https://github.com/java-james/flutter_dotenv/issues/93), [#​101](https://github.com/java-james/flutter_dotenv/issues/101), [#​125](https://github.com/java-james/flutter_dotenv/issues/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](https://github.com/java-james/flutter_dotenv/issues/72), [#​127](https://github.com/java-james/flutter_dotenv/issues/127); improves diagnostics for [#​59](https://github.com/java-james/flutter_dotenv/issues/59), [#​89](https://github.com/java-james/flutter_dotenv/issues/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()`.
### [`v6.0.0`](https://github.com/java-james/flutter_dotenv/blob/HEAD/CHANGELOG.md#600)
[Compare Source](https://github.com/java-james/flutter_dotenv/compare/5.2.1...6.0.0)
- \[feat] Allow passing in override .env files on init
- \[feat] Load .env from a passed in string
##### Breaking changes
- **Renamed**: `testLoad` → `loadFromString`\
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.
</details>
---
### Configuration
📅 **Schedule**: (UTC)
- Branch creation
- At any time (no schedule defined)
- Automerge
- At any time (no schedule defined)
🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
---
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
---
This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yNjQuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjQuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiYm90IiwidXBncmFkZSJdfQ==-->
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
any of the package files in this branch needs updating, or
the branch becomes conflicted, or
you click the rebase/retry checkbox if found above, or
you rename this PR's title to start with "rebase!" to trigger it manually
The artifact failure details are included below:
File name: pubspec.lock
spawn flutter ENOENT
### ⚠️ Artifact update problem
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
- any of the package files in this branch needs updating, or
- the branch becomes conflicted, or
- you click the rebase/retry checkbox if found above, or
- you rename this PR's title to start with "rebase!" to trigger it manually
The artifact failure details are included below:
##### File name: pubspec.lock
```
spawn flutter ENOENT
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This PR contains the following updates:
^5.2.1→^6.0.0Release Notes
java-james/flutter_dotenv (flutter_dotenv)
v6.0.1Compare Source
isEveryDefined()now throwsNotInitializedErrorbeforeload(), consistent with all other read APIsassert()with explicitif/throwingetInt(),getDouble(), andgetBool()so null-safety checks are enforced in release buildsload(isOptional: true)no longer discards successfully loaded base file when an override file is missing or empty (fixes #70, #93, #101, #125)clean()now resetsisInitializedtofalse, so accessingenvafterclean()correctly throwsNotInitializedErrorNotInitializedError,FileNotFoundError,EmptyEnvFileError) now include informative messages intoString()instead of the unhelpfulInstance of 'ClassName'(fixes #72, #127; improves diagnostics for #59, #89)FileNotFoundErrorandEmptyEnvFileErrornow carry the filename when availableNote on error message improvements
NotInitializedError,FileNotFoundError, andEmptyEnvFileErrornow overridetoString()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 existingon FileNotFoundErrorcatch clauses continue to work.FileNotFoundErrornow accepts an optional positionalfilenameparameter, andEmptyEnvFileErroraccepts an optional namedfilenameparameter; both default tonullfor backward compatibility.Note on release-build behavior change
In debug mode, behavior is unchanged —
AssertionErrorwas thrown before,AssertionErroris thrown now.In release mode, calling
getInt(),getDouble(), orgetBool()with a missing variable and no fallback previously threw aTypeError(from the null-check operator!) becauseassert()was stripped. It now correctly throwsAssertionErrorwith a descriptive message. If your release-mode code catcheson TypeErroraround these methods, update it to catchon AssertionError(oron Error) instead.Breaking change:
clean()now resets initialization statePreviously, calling
clean()only cleared the env map but leftisInitialized == true. Now it also setsisInitialized = false. Code that callsclean()and then immediately accessesdotenv.envwithout reloading will now throwNotInitializedError. The fix is to callload()orloadFromString()again afterclean().v6.0.0Compare Source
Breaking changes
Renamed:
testLoad→loadFromStringThe method has been renamed to better reflect that it can be used outside of test environments.
⚠️ Update your code to call
loadFromString()instead oftestLoad().Behavior change: Empty file handling with
isOptional = truePreviously, if the env file was empty and
isOptionalwastrue, 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 supports2.12.0onwards.Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate CLI.
⚠️ Artifact update problem
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
The artifact failure details are included below:
File name: pubspec.lock
69e647d33fto604b73b2ffView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.