parseRef abstract method
- String name,
- Object? description, {
- required Description containingDescription,
- required LanguageVersion languageVersion,
Parses a PackageRef from a name and a user-provided description
.
When a Pubspec
is parsed, it reads in the description for each
dependency. It is up to the dependency's Source
to determine how that
should be interpreted. This will be called during parsing to validate that
the given description
is well-formed according to this source, and to
give the source a chance to canonicalize the description. For simple
hosted dependencies like foo:
or foo: ^1.2.3
, the description
may
also be null
.
containingDescription
describes the location of the pubspec where this
description appears.
languageVersion
is the minimum Dart version parsed from the pubspec's
environment
field. Source implementations may use this parameter to only
support specific syntax for some versions.
The description in the returned PackageRef need bear no resemblance to the original user-provided description.
Throws a FormatException if the description is not valid.
Implementation
PackageRef parseRef(
String name,
Object? description, {
required Description containingDescription,
required LanguageVersion languageVersion,
});