getPackageNameFromGitRepo function
Given a Git repo that contains a pub package, gets the name of the pub package.
Will download the repo to the system cache under the assumption that the package will be downloaded afterwards.
url
points to the git repository. If it is a relative url, it is resolved
as a file url relative to the path relativeTo
.
ref
is the commit, tag, or branch name where the package should be looked
up when fetching the name. If omitted, 'HEAD' is used.
tagPattern
is a string containing '{{version}}'
as a substring, the
latest tag matching the pattern will be used for fetching the name.
Only one of ref
and tagPattern
can be used.
If isOffline
, only the already cached versions of the repo is used.
Implementation
Future<String> getPackageNameFromGitRepo(
String url, {
String? ref,
String? path,
String? tagPattern,
String? relativeTo,
bool isOffline = false,
}) async {
return await GitSource.instance.getPackageNameFromRepo(
url,
ref,
path,
SystemCache(isOffline: isOffline),
relativeTo: relativeTo,
tagPattern: tagPattern,
);
}