{"id":30858937,"url":"https://github.com/solid-software/hydrated","last_synced_at":"2025-09-07T14:55:37.504Z","repository":{"id":44933642,"uuid":"162637750","full_name":"solid-software/hydrated","owner":"solid-software","description":"🚰 A BehaviorSubject for Flutter with automatic persist and hydrate.","archived":false,"fork":false,"pushed_at":"2022-01-17T19:21:11.000Z","size":1189,"stargazers_count":115,"open_issues_count":2,"forks_count":18,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-11-07T20:05:43.144Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/hydrated","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/solid-software.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":"2018-12-20T22:28:07.000Z","updated_at":"2023-09-06T16:50:47.000Z","dependencies_parsed_at":"2022-08-29T08:40:35.845Z","dependency_job_id":null,"html_url":"https://github.com/solid-software/hydrated","commit_stats":null,"previous_names":[],"tags_count":6,"template":null,"template_full_name":null,"purl":"pkg:github/solid-software/hydrated","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solid-software%2Fhydrated","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solid-software%2Fhydrated/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solid-software%2Fhydrated/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solid-software%2Fhydrated/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solid-software","download_url":"https://codeload.github.com/solid-software/hydrated/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solid-software%2Fhydrated/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274051961,"owners_count":25214030,"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-07T02:00:09.463Z","response_time":67,"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-09-07T14:55:28.035Z","updated_at":"2025-09-07T14:55:37.484Z","avatar_url":"https://github.com/solid-software.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hydrated\n\n[![Version](https://img.shields.io/pub/v/hydrated)](https://pub.dev/packages/hydrated)\n[![Build](https://img.shields.io/github/workflow/status/lukepighetti/hydrated/Flutter)](https://github.com/lukepighetti/hydrated/actions?query=Flutter)\n[![License](https://img.shields.io/github/license/lukepighetti/hydrated)](https://opensource.org/licenses/MIT)\n[![style: solid](https://img.shields.io/badge/style-solid-orange)](https://pub.dev/packages/solid_lints)\n\nHydrated provides a Subject that automatically persists to Flutter's local storage and hydrates on creation!\n\n\n## Easy to consume\n\nAll values are persisted with `shared_preferences` and restored with automatic hydration.\n\n```dart\nfinal count$ = HydratedSubject\u003cint\u003e(\"count\", seedValue: 0);\n\n/// count$ will automagically be hydrated with 42 next time it is created\ncount$.add(42);\n```\n\n## Ready for BLoC\n\n```dart\nclass HydratedBloc {\n  final _count$ = HydratedSubject\u003cint\u003e(\"count\", seedValue: 0);\n\n  ValueObservable\u003cint\u003e get count$ =\u003e _count$.stream;\n  Sink\u003cint\u003e get setCount =\u003e _count$.sink;\n\n  dispose() {\n    _count$.close();\n  }\n}\n```\n\n## Supports simple types and serialized classes\n\nWe support all `shared_preferences` types.\n\n- `int`\n- `double`\n- `bool`\n- `String`\n- `List\u003cString\u003e`\n\n```dart\nfinal count$ = HydratedSubject\u003cint\u003e(\"count\");\n```\n\nWe also support serialized classes with `hydrate` and `persist` arguments.\n\n```dart\nfinal user$ = HydratedSubject\u003cUser\u003e(\n  \"user\",\n  hydrate: (String s) =\u003e User.fromJson(s),\n  persist: (User user) =\u003e user.toJson(),\n);\n```\n\n## Reliable\n\nHydrated is mock tested with all supported types and is dogfooded by its creator.\n\n## Extensible\n\nHydrated supports any key-value data storages -- just implement the `KeyValueStore` interface\nand you will be able to use *hive*, *flutter_secure_storage* or any other persistence solution of your choice.\n\n```dart\nclass MyAwesomeKeyValueStore implements KeyValueStore {\n  /// your implementation here...\n}\n\nfinal user = HydratedSubject\u003cUser\u003e(\n  \"user\",\n  hydrate: (String s) =\u003e User.fromJson(s),\n  persist: (User user) =\u003e user.toJson(),\n  keyValueStore: MyAwesomeKeyValueStore()\n);\n```\n\n## Demo\n\n\u003cimg alt=\"demo of Hydrated BehaviorSubject between app restarts\" src=\"https://raw.githubusercontent.com/lukepighetti/hydrated/master/doc/hydrated.gif\" width=\"400\"\u003e\n\n## Original developer\n\n`hydrated` was originally developed by [@lukepighetti](https://github.com/lukepighetti).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolid-software%2Fhydrated","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolid-software%2Fhydrated","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolid-software%2Fhydrated/lists"}