PlayxEnv class abstract

Wrapper for configure any the application with global variables using a .env file.

Constructors

PlayxEnv()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

instance → DotEnv
no setter

Static Methods

getBool(String key, {bool fallback = false}) Future<bool>
return the dotenv value in String else returns fallback which default to -1.
getDouble(String key, {double fallback = -1}) Future<double>
return the dotenv value in String else returns fallback which default to -1.
getInt(String key, {int fallback = -1}) Future<int>
return the dotenv value in String else returns fallback which default to -1.
getString(String key, {String fallback = ''}) Future<String>
return the dotenv value in String else returns fallback which default to empty String.
load({String fileName = '.env', Parser parser = const Parser(), Map<String, String> mergeWith = const {}, bool isOptional = true}) Future<void>
Load the .env file and parse the content. fileName is the name of the file to load, default to .env. parser is the parser to use, default to Parser(). mergeWith is a map of variables to merge with the loaded ones, default to empty map. isOptional is a flag to indicate if the file is optional, default to true.
maybeGetBool(String key) Future<bool?>
return the dotenv value in bool else returns null.
maybeGetDouble(String key) Future<double?>
return the dotenv value in double else returns null.
maybeGetInt(String key) Future<int?>
return the dotenv value in int else returns null.
maybeGetString(String key) Future<String?>
return the dotenv value in String else returns null.