Baseflow / Baseflow/flutter_cache_manager

url 404 and retry always 404

Aperta
#473 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Dart
Stelle
809
Fork
510
Merge medio
6m
PR unite (30g)
1

Descrizione

## 💬 Questions and Help

Here I'm using cached_network_image to loading network image. It may not exists with the giving image url, when I get 404 from errorListener, I async image to the url to make sure url is available. After that I refresh the CachedNetworkImage, still get error 404 from errorWidget.

```
Widget imgWidget() {
return CachedNetworkImage(
imageUrl: _imageUrl,
imageBuilder: (context, imageProvider) {
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: imageProvider,
fit: widget.fit,
),
),
);
},
placeholder: (context, url) {
return widget.placeholder;
},
errorWidget: (context, url, error) {
return widget.placeholder;
},
errorListener: (e) {
if (e is HttpException) {
logger.d('----- errorListener ${e.uri.toString()} - ${e.message}');
if (e.message.contains('404')) {
_syncImage();
}
} else {
logger.d('Image Exception is: ${e.runtimeType}');
}
},
);
}

_syncImage() async {
HttpManager().syncImageToCdnUrl(_imageUrl).then((_) {
setState(() { });
}).catchError((onError) {
logger.d(onError);
});
}

```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the CachedNetworkImage entry point, especially its errorListener, errorWidget, and refresh behavior after _syncImage calls setState. Reproduce the sequence where the initial URL returns 404, the URL is synchronized, and the widget is refreshed; done means the refreshed image no longer reports the cached 404 when the URL is available.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
dart, flutter
Ambito
mobile-dev
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.