{"id":18898404,"url":"https://github.com/hychen/flutter_js_datascript","last_synced_at":"2026-05-01T04:35:51.081Z","repository":{"id":56829588,"uuid":"425804811","full_name":"hychen/flutter_js_datascript","owner":"hychen","description":"Using DataScript in Flutter Apps.","archived":false,"fork":false,"pushed_at":"2021-12-06T00:09:24.000Z","size":335,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-31T08:45:42.740Z","etag":null,"topics":["datascript","flutter"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hychen.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-11-08T11:08:25.000Z","updated_at":"2021-12-06T00:09:23.000Z","dependencies_parsed_at":"2022-08-28T20:10:09.895Z","dependency_job_id":null,"html_url":"https://github.com/hychen/flutter_js_datascript","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hychen%2Fflutter_js_datascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hychen%2Fflutter_js_datascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hychen%2Fflutter_js_datascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hychen%2Fflutter_js_datascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hychen","download_url":"https://codeload.github.com/hychen/flutter_js_datascript/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239879317,"owners_count":19712176,"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":["datascript","flutter"],"created_at":"2024-11-08T08:42:32.456Z","updated_at":"2026-03-01T10:30:15.998Z","avatar_url":"https://github.com/hychen.png","language":"Dart","readme":"\u003c!--\nThis README describes the package. If you publish this package to pub.dev,\nthis README's contents appear on the landing page for your package.\n\nFor information about how to write a good package README, see the guide for\n[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).\n\nFor general information about developing packages, see the Dart guide for\n[creating packages](https://dart.dev/guides/libraries/create-library-packages)\nand the Flutter guide for\n[developing packages and plugins](https://flutter.dev/developing-packages).\n--\u003e\n\nUsing DataScript in Flutter Apps.\n\n\u003e This package is in very early stage and only be tested on MacOS. Use it with caution and file\nany potential issues you see.\n\n## Features\n\nUse this package to\n- Transact with Datoms.\n- Query result by using [datalog](https://en.wikipedia.org/wiki/Datalog) language.\n\n### Supported APIs:\n  - creteConn\n  - q\n  - listen\n  - unlisten\n  - initDb\n  - datoms\n  - pull\n  - pullMany\n  - connFromDb\n  - connFromDatoms\n  - resetConn\n  - initDb\n  - dbWith\n  - emptyDb\n  - entityDb\n  - entity\n  - touch\n  - resolveTempids\n\n## Getting started\n\n```shell\nflutter pub add flutter_js_datascript\n```\n\n## Usage\n\n```dart\nimport 'package:flutter_js_datascript/flutter_js_datascript.dart';\n\nvoid main() async {\n    var d = Datascript();\n\n    // create DB schema, a regular JS Object\n    final builder = SchemaBuilder()\n      ..attr('aka', cardinality: Cardinality.many)\n      ..attr('friend', valueType: ValueType.ref);\n    final schema = builder.build();\n\n    // Use JS API to create connection and add data to DB\n    // create connection using schema\n    var conn = d.createConn(schema: schema);\n\n    // setup listener called main\n    // pushes each entity (report) to an Array of reports\n    // This is just a simple example. Make your own!\n    var reports = [];\n    d.listen(conn, 'main', (report) {\n      reports.add(report);\n    });\n\n    // define initial datoms to be used in transaction\n    var datoms = [\n      {\n        \":db/id\": -1,\n        \"name\": \"Ivan\",\n        \"age\": 18,\n        \"aka\": [\"X\", \"Y\"]\n      },\n      {\n        \":db/id\": -2,\n        \"name\": \"Igor\",\n        \"aka\": [\"Grigory\", \"Egor\"]\n      },\n      // use :db/add to link datom -2 as friend of datom -1\n      [\":db/add\", -1, \"friend\", -2]\n    ];\n\n    // Tx is Js Array of Object or Array\n    // pass datoms as transaction data\n    var report = d.transact(conn, datoms, txMeta: \"initial info about Igor and Ivan\");\n\n    var db = d.db(conn);\n\n    // Fetch names of people who are friends with someone 18 years old\n    // query values from conn with JS API\n    var result = await d.q(\n        '[:find ?n :in \\$ ?a :where [?e \"friend\" ?f] [?e \"age\" ?a] [?f \"name\" ?n]]',\n        [db, 18]);\n    // print query result to console!\n    print(result);  // [[\"Igor\"]]\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhychen%2Fflutter_js_datascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhychen%2Fflutter_js_datascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhychen%2Fflutter_js_datascript/lists"}