replace method

void replace(
  1. String name,
  2. PropertySource propertySource
)

Replaces the PropertySource with the given name with a new one.

Throws if the named source is not present.

Example:

sources.replace('env', MapPropertySource('env', {'mode': 'prod'}));

Implementation

void replace(String name, PropertySource propertySource) {
  synchronized(_sources, () {
    int index = _assertPresentAndGetIndex(name);
    _sources[index] = propertySource;
  });
}