{"id":30672982,"url":"https://github.com/janlionly/flutter_precached_network_image","last_synced_at":"2025-09-01T05:40:23.534Z","repository":{"id":64961002,"uuid":"579935850","full_name":"janlionly/flutter_precached_network_image","owner":"janlionly","description":"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.","archived":false,"fork":false,"pushed_at":"2025-04-08T11:46:56.000Z","size":117,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T12:36:46.427Z","etag":null,"topics":["cache-storage","cached-network-images","memory-cache","precache"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/janlionly.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-19T10:05:54.000Z","updated_at":"2025-04-08T11:46:19.000Z","dependencies_parsed_at":"2025-02-25T09:32:15.286Z","dependency_job_id":null,"html_url":"https://github.com/janlionly/flutter_precached_network_image","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/janlionly/flutter_precached_network_image","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlionly%2Fflutter_precached_network_image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlionly%2Fflutter_precached_network_image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlionly%2Fflutter_precached_network_image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlionly%2Fflutter_precached_network_image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janlionly","download_url":"https://codeload.github.com/janlionly/flutter_precached_network_image/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janlionly%2Fflutter_precached_network_image/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273077227,"owners_count":25041358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache-storage","cached-network-images","memory-cache","precache"],"created_at":"2025-09-01T05:40:12.619Z","updated_at":"2025-09-01T05:40:23.478Z","avatar_url":"https://github.com/janlionly.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Precached network image\n\n[![pub package](https://img.shields.io/pub/v/precached_network_image.svg)](https://pub.dartlang.org/packages/precached_network_image)\u003ca href=\"https://github.com/janlionly/flutter_precached_network_image\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/janlionly/flutter_precached_network_image.svg?style=flat\u0026logo=github\u0026colorB=deeppink\u0026label=stars\" alt=\"Star on Github\"\u003e\u003c/a\u003e\n\nFlutter 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.\n\n## Features\n\n- ✅ **Multi-platform support**: Works on iOS, Android, and Web platforms\n- ✅ **Advanced caching**: Dual-layer caching with memory and disk storage\n- ✅ **Precaching**: Load images to memory in advance to prevent flickering\n- ✅ **Web compatibility**: Uses localStorage for web platform caching\n- ✅ **Flexible storage**: Automatic platform-specific storage selection\n- ✅ **Error handling**: Comprehensive error handling and fallback support\n- ✅ **Performance optimized**: Efficient image loading and caching strategies\n\n## Platform Support\n\n| Platform | Cache Storage | Memory Precaching | Status |\n|----------|---------------|------------------|---------|\n| iOS      | File System   | ✅ Yes           | ✅ Supported |\n| Android  | File System   | ✅ Yes           | ✅ Supported |\n| Web      | localStorage  | ✅ Yes           | ✅ Supported |\n\n## Usage\n\nThe PrecachedNetworkImage can be used directly.\n\n```dart\nPrecachedNetworkImage(\n  url: 'https://picsum.photos/200',\n  width: 200, \n  height: 200,\n  precache: true, // default is false, true for next time loading from memory in advance.\n  fit: BoxFit.fill,\n  placeholder: (context, url) =\u003e const Icon(Icons.person),\n  errorWidget: (context, url, error) {\n    log(\"get image failed code: $error\");\n    return const Icon(Icons.error);\n  },\n),\n```\n\nWhen 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.\n\n```dart\n@override\nvoid initState() {\n  super.initState();\n  PrecachedNetworkImageManager.instance.precacheNetworkImages(isLog: true);\n}\n```\n\nPrecachedNetworkImageManager handle about precache(memory) and cache(disk) all methods:\n\n```dart\n/// precache all urls(or the target param urls) to files in memory\n/// usage:\n///   you can call this method in advance(eg. on launch) to avoid the flash screen caused by the delay time\n///   after set the parameter [precache] of PrecachedNetworkImage(..., precache: true) to true.\nprecacheNetworkImages({List\u003cString\u003e urls}); \n\n/// add the url which you want to precache next time\naddPrecache({@required String url});\n\n/// delete the url which you cancel to precache \ndeletePrecache({@required String url});\n\n/// delete the file of given url cache in memory and disk\ndeleteImageCache({@required String url});\n\n/// clean all precache's files of given urls cache in memory and disk\ncleanImageCache();\n\n/// clean all urls precache\ncleanPrecache();\n\n/// clean all urls precache and file cache in memory and disk\ncleanCaches();\n```\n\n## Installation\n\nAdd this to your package's `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  precached_network_image: ^1.2.6\n```\n\n## Requirements\n\n- Dart SDK: `\u003e=2.17.0 \u003c4.0.0`\n- Flutter: `\u003e=1.17.0`\n\n## Author\n\nVisit my github: [janlionly](https://github.com/janlionly)\u003cbr\u003e\nContact with me by email: janlionly@gmail.com\n\n## Contribute\nI would love you to contribute to **PrecachedNetworkImage**\n\n## License\n**PrecachedNetworkImage** is available under the MIT license. See the [LICENSE](https://github.com/janlionly/flutter_precached_network_image/blob/master/LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanlionly%2Fflutter_precached_network_image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanlionly%2Fflutter_precached_network_image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanlionly%2Fflutter_precached_network_image/lists"}