dependencyOverrides property

Map<String, Dependency> dependencyOverrides

Returns an unmodifiable map of the dependency overrides If you need to update the map pass a new map with the updated values.

Implementation

Map<String, Dependency> get dependencyOverrides {
  final depends = <String, Dependency>{};

  final map = pubspec.dependencyOverrides;

  for (final name in map.keys) {
    final reference = map[name]!;
    depends.putIfAbsent(name, () => Dependency(name, reference));
  }

  return Map.unmodifiable(depends);
}
void dependencyOverrides=(Map<String, Dependency> dependencies)

Sets the list of dependencies for this pubspec.

Implementation

set dependencyOverrides(Map<String, Dependency> dependencies) {
  final ref = <String, pub.DependencyReference>{};

  for (final name in dependencies.keys) {
    ref[name] = dependencies[name]!.reference;
  }

  pubspec = pubspec.copy(dependencyOverrides: ref);
}