addAfter method

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

Inserts newSource after the property source named relativeSourceName.

Behavior is the same as addBefore except the new source is placed immediately after the referenced entry.

Example:

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

Implementation

void addAfter(String relativeSourceName, PropertySource newSource) {
  _assertLegalRelativeAddition(relativeSourceName, newSource);

  return synchronized(_sources, () {
    _removeIfPresent(newSource);
    int index = _assertPresentAndGetIndex(relativeSourceName);
    _addAtIndex(index + 1, newSource);
  });
}