reload method
Reloads the ImageProvider from ReloadablePhotoView.
Example:
final _photoViewKey = GlobalKey<ReloadablePhotoViewState>();
final _cache = DefaultCacheManager();
ReloadablePhotoView(
key: _photoViewKey,
imageProviderBuilder: (key) => LocalOrCachedNetworkImageProvider.fromNetwork(
key: key,
url: url,
cacheManager: _cache,
),
// ...
);
// to reload image
await _cache.removeFile(url);
_photoViewKey.currentState?.reload();
Implementation
void reload({bool alsoEvict = true}) {
_notifier.value = DateTime.now().microsecondsSinceEpoch.toString();
if (alsoEvict) {
// evict from flutter ImageCache
var key = ValueKey<String>(_notifier.value);
widget.imageProviderBuilder.call(key).evict();
}
}