addAfter method

void addAfter(
  1. String relativeSourceName,
  2. PropertySource newSource
)

Inserts newSource after the named relativeSourceName in the list.

Throws if the referenced source is not found or if the names are equal.

Example:

sources.addAfter('commandLine', MapPropertySource('logConfig', {...}));

Implementation

void addAfter(String relativeSourceName, PropertySource newSource) {
  _assertLegalRelativeAddition(relativeSourceName, newSource);
  synchronized(_sources, () {
    _removeIfPresent(newSource);
    int index = _assertPresentAndGetIndex(relativeSourceName);
    _addAtIndex(index + 1, newSource);
  });
}