{"id":32298423,"url":"https://github.com/devslane/entity_state","last_synced_at":"2025-10-23T04:56:49.717Z","repository":{"id":61973187,"uuid":"182051832","full_name":"devslane/entity_state","owner":"devslane","description":"Flutter Redux Entity State inspired from Angular Entity State https://ngrx.io/guide/entity","archived":false,"fork":false,"pushed_at":"2019-09-12T06:20:48.000Z","size":110,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-23T04:56:49.477Z","etag":null,"topics":["built-value","entity-state","flutter","flutter-redux","redux"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devslane.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-04-18T08:50:32.000Z","updated_at":"2020-09-30T00:43:39.000Z","dependencies_parsed_at":"2022-10-24T13:31:00.227Z","dependency_job_id":null,"html_url":"https://github.com/devslane/entity_state","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/devslane/entity_state","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devslane%2Fentity_state","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devslane%2Fentity_state/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devslane%2Fentity_state/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devslane%2Fentity_state/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devslane","download_url":"https://codeload.github.com/devslane/entity_state/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devslane%2Fentity_state/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280563531,"owners_count":26351731,"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-10-23T02:00:06.710Z","response_time":142,"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":["built-value","entity-state","flutter","flutter-redux","redux"],"created_at":"2025-10-23T04:56:48.359Z","updated_at":"2025-10-23T04:56:49.702Z","avatar_url":"https://github.com/devslane.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Entity State\n\nEntity State to manage records in your redux state.\n\n## Installation\n\nAdd this to your project's pubspec.yaml\n\n```\ndependencies:\n  entity_state: ^1.2.5\n```\n\n## Usage\n\nIn your redux state\n\n```\nabstract class ReminderState\n    with EntityState\u003cReminder, int, ReminderState, ReminderStateBuilder\u003e\n    implements Built\u003cReminderState, ReminderStateBuilder\u003e {\n  // This is mandatory to add\n  BuiltList\u003cint\u003e get ids;\n\n  // This is mandatory to add\n  BuiltMap\u003cint, Reminder\u003e get entities;\n\n  ReminderState._();\n\n  factory ReminderState([updates(ReminderStateBuilder b)]) = _$ReminderState;\n\n  static Serializer\u003cReminderState\u003e get serializer =\u003e _$reminderStateSerializer;\n  \n  // This will tell the entity state what is the unique identifier of the model.\n  @override\n    int getId(Reminder data) {\n      return data.id;\n    }\n}\n```\n\nIn your reducer\n\n### To Add One\n\n```\nAppNotificationState listNotificationComplete(\n    AppNotificationState appNotificationState,\n    ListNotificationComplete action) {\n  return appNotificationState\n        // action.notification is `Notification`\n      .addOne(action.notification)\n      .rebuild((b) =\u003e b..isLoading = false);\n}\n```\n\n### To Add All (replaces any data that was previously present)\n\n```\nAppNotificationState listNotificationComplete(\n    AppNotificationState appNotificationState,\n    ListNotificationComplete action) {\n  return appNotificationState\n        // action.notifications is `List\u003cNotification\u003e`\n      .addAll(action.notifications)\n      .rebuild((b) =\u003e b..isLoading = false);\n}\n```\n\n### To Add Many (appends to previous data)\n\n```\nAppNotificationState listNotificationComplete(\n    AppNotificationState appNotificationState,\n    ListNotificationComplete action) {\n  return appNotificationState\n        // action.notifications is `List\u003cNotification\u003e`\n      .addMany(action.notifications)\n      .rebuild((b) =\u003e b..isLoading = false);\n}\n```\n\n### To Update One\n\n```\nAppNotificationState listNotificationComplete(\n    AppNotificationState appNotificationState,\n    ListNotificationComplete action) {\n  return appNotificationState\n        // action.notification is `Notification`\n      .updateOne(action.notification)\n      .rebuild((b) =\u003e b..isLoading = false);\n}\n```\n\n### To Update Many\n\n```\nAppNotificationState listNotificationComplete(\n    AppNotificationState appNotificationState,\n    ListNotificationComplete action) {\n  return appNotificationState\n        // action.notifications is `List\u003cNotification\u003e`\n      .updateMany(action.notifications)\n      .rebuild((b) =\u003e b..isLoading = false);\n}\n```\n\n### To Remove One\n\n```\nAppNotificationState listNotificationComplete(\n    AppNotificationState appNotificationState,\n    ListNotificationComplete action) {\n  return appNotificationState\n        // action.notification is `int`\n      .removeOne(action.notificationId)\n      .rebuild((b) =\u003e b..isLoading = false);\n}\n```\n\n### To Remove Many\n\n```\nAppNotificationState listNotificationComplete(\n    AppNotificationState appNotificationState,\n    ListNotificationComplete action) {\n  return appNotificationState\n        // action.notifications is `List\u003cNotification\u003e`\n      .removeMany(action.notifications)\n      .rebuild((b) =\u003e b..isLoading = false);\n}\n```\n\n### To Remove All\n\n```\nAppNotificationState listNotificationComplete(\n    AppNotificationState appNotificationState,\n    ListNotificationComplete action) {\n  return appNotificationState\n        // action.notifications is `List\u003cNotification\u003e`\n      .removeAll()\n      .rebuild((b) =\u003e b..isLoading = false);\n}\n```\n\n### How to get the data\n\n```\nstatic _ViewModel fromStore(Store\u003cAppState\u003e store) {\n       return _ViewModel(\n           notifications: store.state.appNotification.getAll(),\n           isLoading: store.state.appNotification.isLoading,\n           notificationTapped: (AppNotification notification) {\n             store.dispatch(UpdateNotification(notification: notification));\n           });\n     }\n```\n\n### How to get the sorted data\n```\nstatic _ViewModel fromStore(Store\u003cAppState\u003e store) {\n       return _ViewModel(\n           notifications: store.state.appNotification.getAll((notif1,notif2)=\u003enotif1.id.compareTo(notif2.id),\n           });\n     }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevslane%2Fentity_state","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevslane%2Fentity_state","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevslane%2Fentity_state/lists"}