-
Notifications
You must be signed in to change notification settings - Fork 35
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
Update connectivity_util.dart #13
Conversation
Calling "http://www.gstatic.com/generate_204" instead of "google.com" might be more faster and better since google.com returns response body which will take some time also it costs more mobile data. PS: `generate_204` is used for detecting internet connectivity in android, also used for prefetching DNS on chrome, google search and other google products.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I performed the ping test at the address, but I did not get a return. Could you analyze the link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my review it's ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -90,7 +90,7 @@ class ConnectivityUtils { | |||
|
|||
// ignore: close_sinks | |||
final result = await http.get(_serverToPing); | |||
if (result.statusCode == 200 && _callback(result.body)) { | |||
if (result.statusCode > 199 && result.statusCode < 400 && _callback(result.body)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, since custom servers might return results other than 200!
Thanks for the PR! :D |
Calling "http://www.gstatic.com/generate_204" instead of "google.com" might be more faster and better since google.com returns response body which will take some time also it costs more mobile data.
PS:
generate_204
is used for detecting internet connectivity in android, also used for prefetching DNS on chrome, google search and other google products.