YamlConfigReader class Null safety

Config reader that reads configuration from YAML file.

The reader supports parameterization using Handlebars template engine.

Configuration parameters

  • path: path to configuration file
  • parameters: this entire section is used as template parameters
  • ...

See IConfigReader See FileConfigReader

Example

======== config.yml ======
key1: '{{KEY1_VALUE}}'
key2: '{{KEY2_VALUE}}'
===========================

var configReader = YamlConfigReader('config.yml');

var parameters = ConfigParams.fromTuples('KEY1_VALUE', 123, 'KEY2_VALUE', 'ABC');
var config = await configReader.readConfig('123', parameters)
    // Result: key1=123;key2=ABC
Inheritance

Constructors

YamlConfigReader([String? path])
Creates a new instance of the config reader. [...]

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

configure(ConfigParams config) → void
Configures component by passing configuration parameters. [...]
inherited
getPath() String?
Get the path to configuration file.. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
parameterize(String config, ConfigParams parameters) String
Parameterized configuration template given as string with dynamic parameters. [...]
inherited
readConfig(String? correlationId, ConfigParams parameters) Future<ConfigParams>
Reads configuration and parameterize it with given values. [...]
override
readObject(String? correlationId, ConfigParams parameters) → dynamic
Reads configuration file, parameterizes its content and converts it into JSON object. [...]
setPath(String path) → void
Set the path to configuration file. [...]
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

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

Static Methods

readConfig_(String? correlationId, String path, ConfigParams parameters) ConfigParams
Reads configuration from a file, parameterize it with given values and returns a new ConfigParams object. [...]
readObject_(String? correlationId, String path, ConfigParams parameters) → dynamic
Reads configuration file, parameterizes its content and converts it into JSON object. [...]