Env class

Constructors

Env()
factory

Properties

env ↔ Map<String, String>
The values of the .env file. The first read loads the file, so a read gives the same answer whether or not something loaded it before. After that it is a plain map read: the file is never read again.
getter/setter pair
expanded ↔ bool
True when the loaded .env was read with envExpand.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

load({File? file, bool? testing}) → void
Reads the .env file once.
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

Static Properties

appEnv → String
APP_ENV in lower case. Empty when it is not set, which means production. Like get, it loads .env first when nothing did yet.
no setter
flags ↔ CoreFlags
The flags the .env file is read with. Only envExpand is used. Set it at the top of main(), before any env value is read: the file is read once, before AppConfig exists. See CoreFlags.envExpand. The server isolates read .env the same way as the main isolate, without more setup.
getter/setter pair
isTesting → bool
True when APP_ENV=testing is a real environment variable, or the code runs under dart test.
no setter

Static Methods

get<T>(String key, [dynamic defaultValue]) → T
get env value
parse(String contents, {Map<String, String> known = const <String, String>{}, bool expand = false}) → Map<String, String>
Reads the text of a .env file.