【问题标题】:Connectivity loss while sending data发送数据时连接丢失
【发布时间】:2019-12-08 19:12:21
【问题描述】:

我想知道是否有办法知道在我发送数据(几个带照片的文档)时连接是否丢失。 现在,如果我突然断开连接,我的 CircularProgressIndicator() 会继续运行。如何抛出错误或设置超时? 有时我会收到SocketException: OS Error: Operation timed out, errno = 60, address = ***.com, port = 49434,但并非总是如此

【问题讨论】:

标签: flutter dart connectivity


【解决方案1】:

你可以捕捉到错误:

try {
/// Send your data
} on SocketException {
/// Do something
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-27
    • 1970-01-01
    • 2022-08-23
    相关资源
    最近更新 更多