GlobalConfiguration class

Class for managing different configuration.

Use it with GlobalConfiguration() to access the singleton.

Constructors

GlobalConfiguration()
factory

Properties

appConfig Map<String, dynamic>
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

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 given key 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 when keyPath 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 given key.
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 given key.
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 given key in the storage.

Operators

operator ==(Object other) bool
The equality operator.
inherited