GlobalConfiguration class
Class for managing different configuration.
Use it with GlobalConfiguration() to access the singleton.
Constructors
- GlobalConfiguration()
-
factory
Properties
Methods
-
add(
Map< String, dynamic> map) → dynamic -
Adds the given
map
to the storage. -
addValue(
String key, dynamic value) → void -
Adds the given
value
at the givenkey
to the storage. -
clear(
) → void - Clear the persistent storage. Only for Unit testing!
-
get(
String key) → dynamic -
Reads a value of any type from persistent storage for the given
key
. -
getBool(
String key) → bool -
Reads a bool value from persistent storage for the given
key
, throwing an exception if it's not a bool. -
getDeepValue<
T> (String keyPath) → T? -
Reads a value of T type from persistent storage for the given
keyPath
whenkeyPath
is a Json path separated by ':' like 'appColors:primaryColor' when our Json file is: -
getDouble(
String key) → double -
Reads a double value from persistent storage for the given
key
, throwing an exception if it's not a double. -
getInt(
String key) → int -
Reads a int value from persistent storage for the given
key
, throwing an exception if it's not an int. -
getString(
String key) → String -
Reads a String value from persistent storage for the given
key
, throwing an exception if it's not a String. -
getValue<
T> (String key) → T -
Reads a value of T type from persistent storage for the given
key
. -
loadFromAsset(
String name) → Future< GlobalConfiguration> -
Loading a json configuration file with the given
name
into the current app config. -
loadFromMap(
Map< String, dynamic> map) → GlobalConfiguration -
Loading a configuration
map
into the current app config. -
loadFromPath(
String path) → Future< GlobalConfiguration> -
Loading a json configuration file from a custom
path
into the current app config. -
loadFromPathIntoKey(
String path, String key) → Future< GlobalConfiguration> -
Loading a json configuration file from a custom
path
into the current app config with the givenkey
. -
loadFromUrl(
String url, {Map< String, String> ? queryParameters, Map<String, String> ? headers}) → Future<GlobalConfiguration> -
Loading a configuration file from the given
url
into the current app config using a http GET request to fetch the configuration. -
loadFromUrlIntoKey(
String url, String key, {Map< String, String> ? queryParameters, Map<String, String> ? headers}) → Future<GlobalConfiguration> -
Loading a configuration file from the given
url
into the current app config with the givenkey
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setValue(
dynamic key, dynamic value) → void - Write a value from persistent storage, throwing an exception if it's not the correct type
-
toString(
) → String -
A string representation of this object.
inherited
-
updateValue(
String key, dynamic value) → void -
Update the given
value
for the givenkey
in the storage.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited