💬 Questions and Help
Hi, first of all thank you for your efforts with this much needed fork!
I opened this issue to identify any available strategy regarding setting a network timeout while downloading an image OR what could be the best plan of action to implement such a feature.
As far as I understand, most suggests to wrap CachedNetworkImage into a FutureBuilder with the future property set to Future.delayed(Duration(seconds: X)). Doing so requires custom State logic to be implemented to take action on future completion whether the CachedNetworkImage finished downloading the image or not in the meantime. Also this method does not close the http connection to the server, leading to (possibly) unexpected behaviour.
Another solution is to set the connectionTimeout property of the http client and then use that client with CacheManager. This solution correctly closes the http connection to the server on timeout, but is set globally per http client (all requests coming from this client will have the same timeout value which could not be optimal). Also, the Android cronet_http library does not expose a connection timeout property at all (dart-lang/http#1186).
Relevant issues:
What do you think could be the best way to tackle this problem?
Feel free to convert this issue into a discussion as you see fit.
Thanks,
Matteo
💬 Questions and Help
Hi, first of all thank you for your efforts with this much needed fork!
I opened this issue to identify any available strategy regarding setting a network timeout while downloading an image OR what could be the best plan of action to implement such a feature.
As far as I understand, most suggests to wrap CachedNetworkImage into a FutureBuilder with the future property set to
Future.delayed(Duration(seconds: X)). Doing so requires custom State logic to be implemented to take action on future completion whether the CachedNetworkImage finished downloading the image or not in the meantime. Also this method does not close the http connection to the server, leading to (possibly) unexpected behaviour.Another solution is to set the
connectionTimeoutproperty of the http client and then use that client withCacheManager. This solution correctly closes the http connection to the server on timeout, but is set globally per http client (all requests coming from this client will have the same timeout value which could not be optimal). Also, the Android cronet_http library does not expose a connection timeout property at all (dart-lang/http#1186).Relevant issues:
What do you think could be the best way to tackle this problem?
Feel free to convert this issue into a discussion as you see fit.
Thanks,
Matteo