Last updated:
0 purchases
repository url
Alternative Uri object for handling Git repository URL format #
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 [email protected]: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("[email protected]:alice/sample_text.git");
copied to clipboard
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("[email protected]:alice/sample_text.git");
copied to clipboard
More usage can be found in example;
License #
BSD-3
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.