简体   繁体   English

Flutter Chopper 互联网连接

[英]Flutter Chopper Internet connectivity

How in flutter project check internet connectivity and throw a page with text like "No internet" using Chopper only?如何在颤振项目中检查互联网连接并仅使用 Chopper 抛出带有“无互联网”之类的文本的页面? without data_connection_checker or else没有 data_connection_checker 或其他

Chopper interacts with HTTP/HTTPS, whereas internet connectivity checking deals with lower levels of the IP stack . Chopper 与 HTTP/HTTPS 交互,而互联网连接检查处理较低级别的IP 堆栈

You can technically try to make a request, and see if you get some kind of error, but that's not a reliable way.从技术上讲,您可以尝试发出请求,看看是否会出现某种错误,但这不是一种可靠的方法。 Often if there's no connection, the request will timeout, which could take a while.通常,如果没有连接,请求会超时,这可能需要一段时间。 Even if you set a short timeout, it's much better to use a connectivity client.即使您设置了较短的超时时间,使用连接客户端也会好得多。

The canonical plugin is connectivity_plus规范插件是connectivity_plus

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM