{"id":18048784,"url":"https://github.com/marcelgarus/flutter_cached","last_synced_at":"2026-01-11T13:31:32.226Z","repository":{"id":56826849,"uuid":"212874048","full_name":"MarcelGarus/flutter_cached","owner":"MarcelGarus","description":"🧾 Flutter widget allowing easy cache-based data display in a ListView featuring pull-to-refresh and error banners.","archived":false,"fork":false,"pushed_at":"2020-05-12T14:29:27.000Z","size":523,"stargazers_count":17,"open_issues_count":4,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-12T04:32:33.614Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MarcelGarus.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}},"created_at":"2019-10-04T17:59:49.000Z","updated_at":"2022-01-18T23:07:35.000Z","dependencies_parsed_at":"2022-08-26T14:11:25.990Z","dependency_job_id":null,"html_url":"https://github.com/MarcelGarus/flutter_cached","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MarcelGarus/flutter_cached","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fflutter_cached","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fflutter_cached/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fflutter_cached/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fflutter_cached/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MarcelGarus","download_url":"https://codeload.github.com/MarcelGarus/flutter_cached/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MarcelGarus%2Fflutter_cached/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259718922,"owners_count":22901188,"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","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":"2024-10-30T20:15:23.531Z","updated_at":"2026-01-11T13:31:32.199Z","avatar_url":"https://github.com/MarcelGarus.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"Often, apps just display data fetched from some server.\nThis package introduces the concept of fetchable streams. They are just like normal `Stream`s, but can be fetched.\n\nLet's say you want to load `Fruit`s from a server:\n\n```dart\nfinal stream = FetchStream.create\u003cFruit\u003e(() {\n  // Do some network request and parse it to obtain a Fruit.\n});\nstream.listen(print);\n\n// By default, the stream never emits and events. Only after calling fetch(), it\n// calls the provided function and emits the result.\nstream.fetch();\n\n// Calling fetch again executes the function again and provides the result to\n// all listeners. If the function is already running, it's not called again.\nstream.fetch();\n\n// After your're done using the stream, dispose it.\nawait Future.delayed(Duration(seconds: 10));\nstream.dispose();\n```\n\nThe real magic happens by calling `stream.cached()`.\nThis creates a cached version of this stream using the provided methods.\n\n```dart\nfinal cachedStream = stream.cached(\n  save: (fruit) {\n    // Save the fruit to storage.\n  },\n  load: (fruit) async* {\n    // Load the fruit from storage and yield it. If there are updates to the\n    // fruit, you can also optionally yied them too.\n  },\n);\n```\n\nAnd that's about it!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelgarus%2Fflutter_cached","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcelgarus%2Fflutter_cached","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelgarus%2Fflutter_cached/lists"}