图片网址抖动失败时应用崩溃

时间:2019-11-21 04:57:55

标签: flutter flutter-image

Exception caught by package:flutter_image ═════════════════════════════════════════════════
The following FetchFailure was thrown NetworkImageWithRetry failed to load http://204.11.59.195/~automobi/aiswariaooh/uploads/images/1573712028.jpg:
FetchFailure(
  attemptCount: 1
  httpStatusCode: 404
  totalDuration: 0:00:01.143462
  originalException: null
)

我尝试了stackoverflow中提供的解决方案,但我的问题没有解决

Image(  image: NetworkImageWithRetry(img1),
        height: imageHeight, 
        ),

1 个答案:

答案 0 :(得分:0)

Use this package : (https://pub.dev/packages/cached_network_image)!: 

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