add method

void add({
  1. required String name,
  2. required Folder rootFolder,
  3. String packageUriStr = 'lib/',
  4. String? languageVersion,
})

Adds a package configuration.

The rootFolder is used to produce the package root URI.

The packageUriStr is optional (defaults to 'lib/'), a relative path resolved against the root URI. The result must be inside the root URI.

The languageVersion specifies the package's Dart language version, in the form of 'X.Y', such as '3.9'.

Implementation

void add({
  required String name,
  required Folder rootFolder,
  String packageUriStr = 'lib/',
  String? languageVersion,
}) {
  if (_packages.any((e) => e.name == name)) {
    throw StateError('Already added: $name');
  }
  _packages.add(
    _PackageDescription(
      name: name,
      rootFolder: rootFolder,
      packageUriStr: packageUriStr,
      languageVersion: languageVersion,
    ),
  );
}