repository_url 1.1.1 copy "repository_url: ^1.1.1" to clipboard
repository_url: ^1.1.1 copied to clipboard

Alternative `Uri` object for handling Git repository URL format

Alternative Uri object for handling Git repository URL format #

Pub version GitHub Sponsors Unit test

There are various format of URL can be applied for fetching Git repository. However, not every format can be simply handled by Uri.parse in Dart. For example, it is possible to parse https://git-example.com/alice/sample_text.git but not git@git-example.com:alice/sample_text.git.

// That works
final Uri httpsGit = Uri.parse("https://git-example.com/alice/sample_text.git");

// FormatException
final Uri altSsh = Uri.parse("git@git-example.com:alice/sample_text.git");

As a result, RepositoryUrl should be used rather than Uri which able to resolve URL that Uri.parse can't:

// Both worked
final RepositoryUrl httpRepo = RepositoryUrl("https://git-example.com/alice/sample_text.git");
final RepositoryUrl altSshRepo = RepositoryUrl("git@git-example.com:alice/sample_text.git");

More usage can be found in example;

License #

BSD-3

0
likes
130
pub points
0%
popularity

Publisher

verified publisherrk0cc.xyz

Alternative `Uri` object for handling Git repository URL format

Repository (GitHub)
View/report issues

Topics

#url #uri #repository #git

Documentation

API reference

Funding

Consider supporting this project:

github.com

License

BSD-3-Clause (LICENSE)

More

Packages that depend on repository_url