facebook twitter hatena line email

Flutter/画像/エラー判定

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

pubspec.yaml

cached_network_image: ^2.0.0
CachedNetworkImage(
   imageUrl: "http://example/hoge.png",
   placeholder: (context, url) => new CircularProgressIndicator(),
   errorWidget: (context, url, error) => new Icon(Icons.error),
),

参考:https://stackoverflow.com/questions/52568872/flutter-how-to-handle-image-network-error-like-404-or-wrong-url/56513785