dependencies property

Map<String, Dependency> get dependencies

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

Implementation

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

  final map = pubspec.dependencies;

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

  return Map.unmodifiable(depends);
}
set dependencies (Map<String, Dependency> dependencies)

Sets the map of dependencies for this pubspec.

Implementation

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

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

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