{"id":19260671,"url":"https://github.com/evant/streamqflite","last_synced_at":"2025-04-21T16:32:11.529Z","repository":{"id":59149809,"uuid":"139283257","full_name":"evant/streamqflite","owner":"evant","description":"flutter reactive stream wrapper around sqflite inspired by sqlbrite","archived":false,"fork":false,"pushed_at":"2023-08-24T03:17:22.000Z","size":27,"stargazers_count":40,"open_issues_count":2,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-01T14:38:17.970Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/evant.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-06-30T22:05:42.000Z","updated_at":"2023-09-05T07:20:38.000Z","dependencies_parsed_at":"2022-09-13T08:50:19.358Z","dependency_job_id":null,"html_url":"https://github.com/evant/streamqflite","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fstreamqflite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fstreamqflite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fstreamqflite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evant%2Fstreamqflite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evant","download_url":"https://codeload.github.com/evant/streamqflite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250091030,"owners_count":21373304,"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-11-09T19:22:26.659Z","updated_at":"2025-04-21T16:32:11.198Z","avatar_url":"https://github.com/evant.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# streamqflite\n\n[![Pub](https://img.shields.io/pub/v/streamqflite.svg)]()\n\nA reactive stream wrapper around [sqflite](https://github.com/tekartik/sqflite) inspired by\n[sqlbrite](https://github.com/square/sqlbrite).\n\n## Getting Started\n\nIn your flutter project, add the dependency to your `pubspec.yaml`\n\n```yaml\ndependencies:\n  ...\n  streamqflite: ^1.0.0\n```\n\n## Usage\n\nImport `streamqflite.dart`\n\n```dart\nimport 'package:streamqflite/streamqflite.dart';\n```\n\nWrap your database in a `StreamDatabase`.\n\n```dart\nvar streamDb = StreamDatabase(db);\n```\n\nYou can then listen to a query\n\n```dart\n// Emits a single row, doesn't emit if the row dosen't exist.\nStream\u003cMyEntry\u003e singleQuery = streamDb.createQuery(\"MyTable\", where: 'id = ?', whereArgs: [id])\n    .mapToOne((row) =\u003e MyEntry(row));\n\n// Emits a single row, or the given default value if the row doesn't exist.\nStream\u003cMyEntry\u003e singleOrDefaultQuery = streamDb.createQuery(\"MyTable\", where: 'id = ?', whereArgs: [id])\n    .mapToOneOrDefault((row) =\u003e MyEntry(row), MyEntry.empty());\n\n// Emits a list of rows.\nStream\u003cList\u003cMyEntry\u003e\u003e listQuery = streamDb.createQuery(\"MyTable\", where: 'name LIKE ?', whereArgs: [query])\n    .mapToList((row) =\u003e MyEntry(row));\n\nvar flexibleQuery = streamDb.createQuery(\"MyTable\", where: 'name LIKE ?', whereArgs: [query])\n    .asyncMap((query) =\u003e {\n        // query is lazy, this lets you not even execute it if you don't need to.\n        if (condition) {\n            return query();\n        } else {\n            return Stream.empty();\n        }\n    }).map((rows) {\n        // Do something with all the rows.\n        return ...;\n    });\n```\n\nThese queries will run once to get the current data, then again whenever the given table is modified\nthough the `StreamDatabase`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevant%2Fstreamqflite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevant%2Fstreamqflite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevant%2Fstreamqflite/lists"}