DotEnv class
Loads key-value pairs from a file into a Map<String, String>.
The parser will attempt to handle simple variable substitution,
respect single- vs. double-quotes, and ignore #comments
or the export
keyword.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- includePlatformEnvironment → bool
-
If true, the underlying map will contain the entries of Platform.environment,
even after calling clear.
Otherwise, it will be empty until populated by load.
final
-
map
→ Map<
String, String> -
Provides access to the underlying Map.
no setter
- quiet → bool
-
If true, suppress "file not found" messages on stderr during load.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addAll(
Map< String, String> other) → void - Calls Map.addAll on the underlying map.
-
clear(
) → void - Calls Map.clear on the underlying map.
-
getOrElse(
String key, String orElse()) → String -
Equivalent to operator [] when the underlying map contains
key
, and the value is non-empty. See isDefined. -
isDefined(
String key) → bool -
True if
key
has a nonempty value in the underlying map. -
isEveryDefined(
Iterable< String> vars) → bool -
True if all supplied
vars
have nonempty value; false otherwise. -
load(
[Iterable< String> filenames = const ['.env'], Parser psr = const Parser()]) → void -
Parses environment variables from each path in
filenames
, and adds them to the underlying Map. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String key) → String? -
Reads the value for
key
from the underlying map.