5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Flutter】画像のダウンロード表示・http通信でエラー(Connection closed before full header was received)

Posted at

画像のダウンロード表示で発生したエラーについて調査しました。

Connection closed before full header was received

遭遇した具体的場面

cached_network_imageを使用してURLを元に画像を表示する時に、正常に画像が表示されないことがありました。
これはcached_network_imageのサンプルコードです。URLを元に画像をダウンロードしてキャッシュしています。
同じURLでも発生する時と発生しない時があり、発生頻度は30回に1回くらいでした。

sampleCode.dart
CachedNetworkImage(
        imageUrl: "http://via.placeholder.com/350x150",
        placeholder: (context, url) => CircularProgressIndicator(),
        errorWidget: (context, url, error) => Icon(Icons.error),
     ),

どうやら画像だけでなくhttp通信でも同様の問題が発生しているという話もちらほらと見受けられました。(原因が同じかは不明ですが)

原因・解決

結論からいうと、Flutterの問題のようで解決策はありませんでした。
FlutterのGitHubスレッド
cached_network_imageのGitHubスレッド

中の人解決頑張れ〜〜〜〜

5
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?