Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer using Uri.parse instead of Uri.http/Uri.https #5834

Merged
merged 1 commit into from
May 21, 2021
Merged

Prefer using Uri.parse instead of Uri.http/Uri.https #5834

merged 1 commit into from
May 21, 2021

Conversation

jamesderlin
Copy link
Contributor

Using Uri.http/Uri.https are much more error-prone than using
Uri.parse, and judging from various StackOverflow questions, quite
a number of people either misunderstand how to use them or would have
avoided their problem by using Uri.parse. Examples:

IMO, we should advocate using Uri.parse when possible, particularly
in tutorials, where using Uri.http/Uri.https directly is a
premature optimization.

Using `Uri.http`/`Uri.https` are *much* more error-prone than using
`Uri.parse`, and judging from various StackOverflow questions, quite
a number of people either misunderstand how to use them or would have
avoided their problem by using `Uri.parse`.  Examples:

* https://stackoverflow.com/q/66619895/
* https://stackoverflow.com/a/66608366/
* https://stackoverflow.com/q/67535694/
* https://stackoverflow.com/q/67628555/
* https://stackoverflow.com/q/67451865/

IMO, we should advocate using `Uri.parse` when possible, particularly
in tutorials, where using `Uri.http`/`Uri.https` directly is a
premature optimization.
@google-cla google-cla bot added the cla: yes Contributor has signed the Contributor License Agreement label May 21, 2021
@jamesderlin jamesderlin requested a review from sfshaza2 May 21, 2021 00:04
@jamesderlin
Copy link
Contributor Author

And note that prior to #5202, some of these sites used Strings directly and formerly would have ended up using Uri.parse internally in package:http anyway.

Copy link
Contributor

@sfshaza2 sfshaza2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yaaaay! You also fixed it in the accompanying Dart files, so the analyzer is happy. LGTM

@sfshaza2 sfshaza2 merged commit 35d15fb into flutter:master May 21, 2021
@jamesderlin jamesderlin deleted the jamesderlin/uri-parse branch June 5, 2021 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Contributor has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants