DotEnv class

Constructors

DotEnv()

Properties

env → Map<String, String>
Variables loaded at runtime from a file + any entries from mergeWith when loaded.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isInitialized → bool
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

clean() → void
Clear env and reset initialization state
get(String name, {String? fallback}) → String
getBool(String name, {bool? fallback}) → bool
Accepts true/1 and false/0 (case-insensitive). Throws AssertionError if not found and no fallback given. Throws FormatException if found but not parseable.
getDouble(String name, {double? fallback}) → double
Throws AssertionError if not found and no fallback given. Throws FormatException if found but not parseable.
getInt(String name, {int? fallback}) → int
Throws AssertionError if not found and no fallback given. Throws FormatException if found but not parseable.
isEveryDefined(Iterable<String> vars) → bool
Returns true if all supplied variables have non-empty values. Throws NotInitializedError if called before load or loadFromString.
load({String fileName = '.env', List<String> overrideWithFiles = const [], Map<String, String> mergeWith = const {}, bool isOptional = false, Parser parser = const Parser()}) → Future<void>
Loads environment variables from the env file into a map Merge with any entries defined in mergeWith overrideWithFiles is a list of other env files whose values will override values read from fileName
loadFromString({String envString = '', List<String> overrideWith = const [], Map<String, String> mergeWith = const {}, bool isOptional = false, Parser parser = const Parser()}) → void
maybeGet(String name, {String? fallback}) → String?
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