path property

List<String>? path
final

A list of keys which specify where in the config source the annotated class should get its values from. The values are ordered from the root of the configuration to the desired sub-object.

Defaults to null, which will get values from the root of the config source.

For example, to create an embedded config for the values in the sub2 object in the below JSON document:

{
  "sub": {
    "sub2": {
      "prop": "value"
    }
  }
}

You would create the following embedded config:

@EmbeddedConfig('<config key>', path: ['sub', 'sub2'])
abstract class Sub2Config {
  String get prop;
}

This is necessary to get config values from any nested config object as an embedded config class can only get values from the single level in the config hierarchy which is it set to read from.

Implementation

final List<String>? path;