{"id":23449544,"url":"https://github.com/danielmahon/flutter_atoms","last_synced_at":"2025-04-10T04:28:01.293Z","repository":{"id":56829074,"uuid":"338419993","full_name":"danielmahon/flutter_atoms","owner":"danielmahon","description":"A simple state management solution inspired by Unity Atoms and built on Riverpod and Flutter Hooks.","archived":false,"fork":false,"pushed_at":"2021-02-12T21:30:54.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-15T18:57:48.804Z","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/danielmahon.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":"2021-02-12T19:59:29.000Z","updated_at":"2022-09-14T17:46:01.000Z","dependencies_parsed_at":"2022-08-28T21:11:44.290Z","dependency_job_id":null,"html_url":"https://github.com/danielmahon/flutter_atoms","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmahon%2Fflutter_atoms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmahon%2Fflutter_atoms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmahon%2Fflutter_atoms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielmahon%2Fflutter_atoms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielmahon","download_url":"https://codeload.github.com/danielmahon/flutter_atoms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248157016,"owners_count":21056938,"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-12-23T23:19:40.582Z","updated_at":"2025-04-10T04:28:01.265Z","avatar_url":"https://github.com/danielmahon.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ⚛️ Flutter Atoms\n\n_(WORK IN PROGRESS)_\n\nA simple state management solution inspired by [Unity Atoms](https://unity-atoms.github.io/unity-atoms/) and built on [riverpod](https://pub.dev/packages/riverpod) and [flutter_hooks](https://pub.dev/packages/flutter_hooks)\n\nThis is bascially a thin wrapper on top of `riverpod` providers that exposes some preset factory functions to generate simple providers. Is it worth it?! I dunno. Feel free to let me know if you think it's worth continuing to develop.\n\nFYI: You can do everything this package can do directly with `riverpod` providers.\n\n## Features\n\n- [x] Void Events\n- [x] Value Events\n- [x] Pair Events (Value events with history)\n- [x] Variables (`StateNotifiers` with optional events)\n- [x] Constants (immutable variables)\n- [x] Void Conditions (pointless?)\n- [x] Value Conditions (reusable conditions)\n\n## Example Usage\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:flutter_hooks/flutter_hooks.dart';\nimport 'package:hooks_riverpod/hooks_riverpod.dart';\nimport 'package:flutter_atoms/flutter_atoms.dart';\n\nfinal changedEvent = createAtomEvent\u003cString\u003e();\nfinal changedHistoryEvent = createAtomPairEvent\u003cString, String\u003e();\nfinal textVariable = createAtomVariable(\n  'hello world',\n  changedEvent: changedEvent,\n  changedWithHistoryEvent: changedHistoryEvent,\n);\n\nclass AtomsExample extends HookWidget {\n  @override\n  Widget build(BuildContext context) {\n    useAtomEvent(changedEvent, (String value) {\n      print('Text Updated: $value');\n    });\n\n    return Center(\n      child: ElevatedButton(\n        onPressed: () =\u003e context.read(changedEvent).raise('foo bar'),\n        child: const Text('Update Text'),\n      ),\n    );\n  }\n}\n\nclass SomeOtherClass extends HookWidget {\n  @override\n  Widget build(BuildContext context) {\n    final myText = useAtomVariable(textVariable);\n\n    useAtomPairEvent(changedHistoryEvent, (String previous, String current) {\n      print('Text Updated from \"$previous\" to \"$current\"');\n    });\n\n    return Center(child: Text(myText));\n  }\n}\n\n```\n\n## Getting Started\n\nThis project is a starting point for a Dart\n[package](https://flutter.dev/developing-packages/),\na library module containing code that can be shared easily across\nmultiple Flutter or Dart projects.\n\nFor help getting started with Flutter, view our\n[online documentation](https://flutter.dev/docs), which offers tutorials,\nsamples, guidance on mobile development, and a full API reference.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielmahon%2Fflutter_atoms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielmahon%2Fflutter_atoms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielmahon%2Fflutter_atoms/lists"}