- Notifications
You must be signed in to change notification settings - Fork0
Download, cache and show images in a flutter app
Baseflow/flutter_cached_network_image_git_advanced_temp
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A flutter library to show images from the internet and keep them in the cache directory.
Try the Flutter Chat Tutorial 💬
The CachedNetworkImage can be used directly or through the ImageProvider.Both the CachedNetworkImage as CachedNetworkImageProvider have minimal support for web. It currently doesn't include caching.
With a placeholder:
CachedNetworkImage( imageUrl:"http://via.placeholder.com/350x150", placeholder: (context, url)=>CircularProgressIndicator(), errorWidget: (context, url, error)=>Icon(Icons.error), ),
Or with a progress indicator:
CachedNetworkImage( imageUrl:"http://via.placeholder.com/350x150", progressIndicatorBuilder: (context, url, downloadProgress)=>CircularProgressIndicator(value: downloadProgress.progress), errorWidget: (context, url, error)=>Icon(Icons.error), ),
Image(image:CachedNetworkImageProvider(url))
When you want to have both the placeholder functionality and want to get the imageprovider to use in another widget you can provide an imageBuilder:
CachedNetworkImage( imageUrl:"http://via.placeholder.com/200x150", imageBuilder: (context, imageProvider)=>Container( decoration:BoxDecoration( image:DecorationImage( image: imageProvider, fit:BoxFit.cover, colorFilter:ColorFilter.mode(Colors.red,BlendMode.colorBurn)), ), ), placeholder: (context, url)=>CircularProgressIndicator(), errorWidget: (context, url, error)=>Icon(Icons.error),),
The cached network images stores and retrieves files using theflutter_cache_manager.
Does it really crash though? The debugger might pause, as the Dart VM doesn't recognize it as a caught exception; the console might print errors; even your crash reporting tool might report it (I know, that really sucks). However, does it really crash? Probably everything is just running fine. If you really get an app crashes you are fine to report an issue, but do that with a small example so we can reproduce that crash.
See for examplethis orthis answer on previous posted issues.
About
Download, cache and show images in a flutter app
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Languages
- Dart68.7%
- C++14.6%
- CMake11.9%
- Ruby1.7%
- Swift1.3%
- C0.9%
- Other0.9%
