commons_config library

The Commons Configuration software library provides a generic configuration interface which enables a Dart/Flutter application to read configuration data from a variety of sources.

Classes

BaseConfiguration
Provides a basic Configuration implementation that is backed by a map.
Configuration
Abstract configuration class. Provides basic functionality but does not store any data. If you want to write your own Configuration class then you should implement only abstract methods from this class. Following is a list of features implemented here:
ConfigurationInterpolator
A class that handles interpolation (variable substitution) for configuration objects. Each instance of Configuration is associated with an object of this class. All interpolation tasks are delegated to this object. ConfigurationInterpolator works together with the StrSubstitutor class from Commons Lang. By extending StrLookup it is able to provide values for variables that appear in expressions. The basic idea of this class is that it can maintain a set of primitive StrLookup objects, each of which is identified by a special prefix. The variables to be processed have the form ${prefix:name}. ConfigurationInterpolator will extract the prefix and determine, which primitive lookup object is registered for it. Then the name of the variable is passed to this object to obtain the actual value. It is also possible to define a default lookup object, which will be used for variables that do not have a prefix or that cannot be resolved by their associated lookup object. When a new instance of this class is created it is initialized with a default set of primitive lookup objects. Per default it contains the following standard lookup objects: EnvStrLookup mapped to the env prefix. CfgEnvStrLookup mapped to the cfg prefix. After an instance has been created the current set of lookup objects can be modified using the registerLookup() and deregisterLookup() methods. The default lookup object (that is invoked for variables without a prefix) can be set with the setDefaultLookup() method. (If a ConfigurationInterpolator instance is created by a configuration object, this lookup points to the configuration itself, so that variables are resolved using the configuration's properties.
ConfigurationLookup
Implements a StrLookup for the Configuration.
EnvStrLookup
Lookup implementation that gets values from the platform environment. This can be used to retrieve environment variables. See Platform.fromEnvironment
FileConfiguration
A persistent configuration loaded and saved to a file.
InavriantReloadingStrategy
A strategy that never triggers a reloading.
MapConfiguration
Provides a Configuration implementation backed by a Map object.
PrefixedKeysIterator
A specialized iterator implementation used by AbstractConfiguration to return an iteration over all keys starting with a specified prefix.
Properties
Represents a set of key value pairs that can be saved to or read from file. Each key and value is a String. Supports synchronous and asynchronous file operations.
PropertiesConfiguration
PropertyConverter
A utility class to convert the configuration properties into any type.
ReloadingStrategy
A strategy to decide if a configuration should be reloaded.
SubsetConfiguration
A subset of another configuration. The new Configuration object contains every key from the parent Configuration that starts with prefix. The prefix is removed from the keys in the subset.
SubsetIterator
A specialized iterator to be returned by the getKeys() methods. This implementation wraps an iterator from the parent configuration. The keys returned by this iterator are correspondingly transformed.

Exceptions / Errors

ConfigurationException
General configuration exception.
ConversionException
Exception thrown when a property is incompatible with the type requested.
NoSuchElementException
Exception thrown when a property is not found.