Precached network image

pub packageStar on Github

Flutter library to load and cache network images to disk and support to precache images to memory in advance to avoid the flash screen caused by the delay time.


The PrecachedNetworkImage can be used directly.

  url: '',
  width: 200, 
  height: 200,
  precache: true, // default is false, true for next time loading from memory in advance.
  fit: BoxFit.fill,
  placeholder: (context, url) => const Icon(Icons.person),
  errorWidget: (context, url, error) {
    log("get image failed code: $error");
    return const Icon(Icons.error);

When you want to precache images to memory to avoid the delay time, you can call PrecachedNetworkImageManager's precacheNetworkImages() which read the disk's files to memory like on the launch widget in advance.

void initState() {

PrecachedNetworkImageManager handle about precache(memory) and cache(disk) all methods:

/// precache all urls(or the target param urls) to files in memory
/// usage:
///   you can call this method in advance(eg. on launch) to avoid the flash screen caused by the delay time
///   after set the parameter [precache] of PrecachedNetworkImage(..., precache: true) to true.
precacheNetworkImages({List<String> urls}); 

/// add the url which you want to precache next time
addPrecache({@required String url});

/// delete the url which you cancel to precache 
deletePrecache({@required String url});

/// delete the file of given url cache in memory and disk
deleteImageCache({@required String url});

/// clean all precache's files of given urls cache in memory and disk

/// clean all urls precache

/// clean all urls precache and file cache in memory and disk


Visit my github: janlionly
Contact with me by email:


I would love you to contribute to PrecachedNetworkImage


PrecachedNetworkImage is available under the MIT license. See the LICENSE file for more info.