{"id":32298277,"url":"https://github.com/amdkholil/network-file-cached","last_synced_at":"2026-07-15T08:31:01.513Z","repository":{"id":217261968,"uuid":"730142311","full_name":"amdkholil/network-file-cached","owner":"amdkholil","description":"flutter package","archived":false,"fork":false,"pushed_at":"2025-01-08T04:19:23.000Z","size":73,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-23T04:54:47.513Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/amdkholil.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-12-11T09:48:02.000Z","updated_at":"2025-06-13T06:19:19.000Z","dependencies_parsed_at":"2024-01-15T10:05:56.899Z","dependency_job_id":"d42e0674-63aa-4bd0-aece-b04292a883c3","html_url":"https://github.com/amdkholil/network-file-cached","commit_stats":null,"previous_names":["amdkholil/network-file-cached"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amdkholil/network-file-cached","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amdkholil%2Fnetwork-file-cached","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amdkholil%2Fnetwork-file-cached/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amdkholil%2Fnetwork-file-cached/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amdkholil%2Fnetwork-file-cached/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amdkholil","download_url":"https://codeload.github.com/amdkholil/network-file-cached/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amdkholil%2Fnetwork-file-cached/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35498250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-15T02:00:06.706Z","response_time":131,"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":[],"created_at":"2025-10-23T04:54:43.621Z","updated_at":"2026-07-15T08:31:01.494Z","avatar_url":"https://github.com/amdkholil.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n## Usage\nUsage example with PDFView to display cached pdf files.\n\n```dart\n\nclass FileCacheSample extends StatefulWidget {\n  const FileCacheSample({super.key, required this.url});\n\n  final String url;\n\n  @override\n  State\u003cFileCacheSample\u003e createState() =\u003e _FileCacheSampleState();\n}\n\nclass _FileCacheSampleState extends State\u003cFileCacheSample\u003e {\n  Future\u003cFile\u003e? file;\n\n  @override\n  void initState() {\n    super.initState();\n    file = getFile();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(\n        title: const Text('Plugin example apps'),\n      ),\n      body: FutureBuilder(\n        future: file,\n        builder: (context, snapshot) {\n          if (snapshot.hasData) {\n            return PDFView(\n              pdfData: snapshot.data?.readAsBytesSync(),\n            );\n          }\n          if (snapshot.hasError) {\n            return Text(snapshot.error.toString());\n          }\n          return const Text('LOADING...');\n        },\n      ),\n    );\n  }\n\n  Future\u003cFile\u003e getFile() {\n    return NetworkFileCached.downloadFile(widget.url);\n  }\n}\n```\n---\nUsage example with loading indicator to display cached pdf files.\n```dart\nawait NetworkFileCached.downloadFile(url, onReceiveProgress: (rcv, total) {\n      setState(() {\n        progress = ((rcv / total) * 100);\n      });\n    }).then((value) {\n      setState(() {\n        file = value;\n      });\n    }).onError((error, stackTrace) {\n      setState(() {\n        errorMessage = error.toString();\n      });\n      throw Exception(error);\n    });\n```\n\nFull code\n```dart\nclass FileCacheLoadingIndicator extends StatefulWidget {\n  const FileCacheLoadingIndicator({super.key, required this.url});\n\n  final String url;\n\n  @override\n  State\u003cFileCacheLoadingIndicator\u003e createState() =\u003e\n      _FileCacheLoadingIndicatorState();\n}\n\nclass _FileCacheLoadingIndicatorState extends State\u003cFileCacheLoadingIndicator\u003e {\n  bool downloading = false;\n  double progress = 0;\n  bool isDownloaded = false;\n  File? file;\n  String errorMessage = '';\n\n  @override\n  void initState() {\n    load(widget.url);\n    super.initState();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(\n        title: const Text('Plugin example apps'),\n      ),\n      body: errorMessage.isNotEmpty\n          ? Center(\n              child: Text(errorMessage),\n            )\n          : file == null\n              ? Center(\n                  child: Stack(\n                    alignment: AlignmentDirectional.center,\n                    children: [\n                      CircularProgressIndicator(\n                        value: (progress == 0) ? null : progress / 100,\n                      ),\n                      if (progress != 0)\n                        Text(\n                          progress.toStringAsFixed(0),\n                          style: const TextStyle(fontSize: 12),\n                        )\n                    ],\n                  ),\n                )\n              : PDFView(\n                  pdfData: file!.readAsBytesSync(),\n                ),\n    );\n  }\n\n  Future\u003cvoid\u003e load(String url) async {\n    await NetworkFileCached.downloadFile(url, onReceiveProgress: (rcv, total) {\n      setState(() {\n        progress = ((rcv / total) * 100);\n      });\n    }).then((value) {\n      setState(() {\n        file = value;\n      });\n    }).onError((error, stackTrace) {\n      setState(() {\n        errorMessage = error.toString();\n      });\n      throw Exception(error);\n    });\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famdkholil%2Fnetwork-file-cached","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famdkholil%2Fnetwork-file-cached","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famdkholil%2Fnetwork-file-cached/lists"}