diff --git a/README.md b/README.md index 7c541e41..eb42ca23 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ provide helpful and descriptive lints. - __⚡ Fast__: Even though drift lets you write powerful queries, it can keep up with the performance of key-value stores like shared preferences and Hive. Drift is the only major persistence library with builtin threading support, allowing you to run database code across isolates with zero additional effort. - __Reactive__: Turn any sql query into an auto-updating stream! This includes complex queries across many tables -- __⚙️ Cross-Platform support__: Drift works on Android, iOS, macOS, Windows, Linux and the web. [This template](https://github.com/rodydavis/moor_shared) is a Flutter todo app that works on all platforms +- __⚙️ Cross-Platform support__: Drift works on Android, iOS, macOS, Windows, Linux and the web. [This template](https://github.com/simolus3/drift/tree/develop/examples/app) is a Flutter todo app that works on all platforms. - __🗡️ Battle tested and production ready__: Drift is stable and well tested with a wide range of unit and integration tests. It powers production Flutter apps. With drift, persistence on Flutter is fun! diff --git a/docs/pages/docs/Examples/index.md b/docs/pages/docs/Examples/index.md index 279a5118..01b0d622 100644 --- a/docs/pages/docs/Examples/index.md +++ b/docs/pages/docs/Examples/index.md @@ -10,6 +10,7 @@ template: layouts/docs/list We have an [example in the repo](https://github.com/simolus3/drift/tree/master/moor_flutter/example), it's a simple todo list app, written with drift. [Rody Davis](https://github.com/rodydavis) has built a cleaner version of the example that works on all Flutter platforms - including Web and Desktop! You can check it out [here](https://github.com/rodydavis/moor_shared). +An updated version of this example is also present in drift's [repository](https://github.com/simolus3/drift/tree/develop/examples/app). [Abdelrahman Mostafa Elmarakby](https://github.com/abdelrahmanelmarakby) wrote an animated version of the todo app available [here](https://github.com/abdelrahmanelmarakby/todo_with_moor_and_animation). The [HackerNews reader app](https://github.com/filiph/hn_app) from the [Boring Flutter Show](https://www.youtube.com/playlist?list=PLjxrf2q8roU3ahJVrSgAnPjzkpGmL9Czl) also uses moor to keep a list of favorite articles. diff --git a/docs/pages/docs/Getting started/index.md b/docs/pages/docs/Getting started/index.md index 740c2df3..265526b9 100644 --- a/docs/pages/docs/Getting started/index.md +++ b/docs/pages/docs/Getting started/index.md @@ -12,6 +12,8 @@ aliases: _Note:_ If you prefer a tutorial video, Reso Coder has made a detailed video explaining how to get started. You can watch it [here](https://youtu.be/zpWsedYMczM). +A complete cross-platform Flutter app using drift is also available [here](https://github.com/simolus3/drift/tree/develop/examples/app). + ## Adding the dependency First, lets add drift to your project's `pubspec.yaml`. At the moment, the current version of `drift` is [![Drift version](https://img.shields.io/pub/v/drift.svg)](https://pub.dev/packages/drift) diff --git a/docs/pages/docs/Getting started/starting_with_sql.md b/docs/pages/docs/Getting started/starting_with_sql.md index d122f1a5..a6572a25 100644 --- a/docs/pages/docs/Getting started/starting_with_sql.md +++ b/docs/pages/docs/Getting started/starting_with_sql.md @@ -9,6 +9,8 @@ template: layouts/docs/single The regular [getting started guide]({{ "index.md" | pageUrl }}) explains how to get started with drift by declaring both tables and queries in Dart. This version will focus on how to use drift with SQL instead. +A complete cross-platform Flutter app using drift is also available [here](https://github.com/simolus3/drift/tree/develop/examples/app). + ## Adding the dependency First, lets add drift to your project's `pubspec.yaml`. At the moment, the current version of `drift` is [![Drift version](https://img.shields.io/pub/v/drift.svg)](https://pub.dev/packages/drift) diff --git a/docs/pages/docs/Other engines/web.md b/docs/pages/docs/Other engines/web.md index 96a7aa6d..e6de8c4b 100644 --- a/docs/pages/docs/Other engines/web.md +++ b/docs/pages/docs/Other engines/web.md @@ -111,7 +111,7 @@ export 'unsupported.dart' if (dart.library.html) 'web.dart'; ``` -A ready example of this construct can also be found [here](https://github.com/rodydavis/moor_shared/blob/master/lib/src/database/database/unsupported.dart). +A ready example of this construct can also be found [here](https://github.com/simolus3/drift/blob/develop/examples/app/lib/database/connection/connection.dart). ## Debugging You can see all queries sent from drift to the underlying database engine by enabling the `logStatements` diff --git a/docs/pages/docs/platforms.md b/docs/pages/docs/platforms.md index 317740c2..a0160f4e 100644 --- a/docs/pages/docs/platforms.md +++ b/docs/pages/docs/platforms.md @@ -28,7 +28,7 @@ This table list all supported drift implementations and on which platforms they | `WasmDatabase` from `package:drift/web.dart` | Web | Potentially faster than a `WebDatabase`, but still experimental and not yet production ready. See [this]({{ 'Other engines/web.md#drift-wasm' | pageUrl }}) for details. | To support all platforms in a shared codebase, you only need to change how you open your database, all other usages can stay the same. -[This repository](https://github.com/rodydavis/moor_shared) gives an example on how to do that with conditional imports. +[This repository](https://github.com/simolus3/drift/tree/develop/examples/app) gives an example on how to do that with conditional imports. ## Mobile (Android and iOS) diff --git a/drift/README.md b/drift/README.md index 373e35d9..f118f19a 100644 --- a/drift/README.md +++ b/drift/README.md @@ -31,7 +31,7 @@ provide helpful and descriptive lints. - __⚡ Fast__: Even though drift lets you write powerful queries, it can keep up with the performance of key-value stores. Drift is the only major persistence library with builtin threading support, allowing you to run database code across isolates with zero additional effort. - __Reactive__: Turn any sql query into an auto-updating stream! This includes complex queries across many tables -- __⚙️ Cross-Platform support__: Drift works on Android, iOS, macOS, Windows, Linux and the web. [This template](https://github.com/rodydavis/moor_shared) is a Flutter todo app that works on all platforms +- __⚙️ Cross-Platform support__: Drift works on Android, iOS, macOS, Windows, Linux and the web. [This template](https://github.com/simolus3/drift/tree/develop/examples/app) is a Flutter todo app that works on all platforms - __🗡️ Battle tested and production ready__: Drift is stable and well tested with a wide range of unit and integration tests. It powers production Flutter apps. drift moor, persistence on Flutter is fun! diff --git a/examples/app/lib/database/database.g.dart b/examples/app/lib/database/database.g.dart index 4a4c9fa4..4c7e9a9b 100644 --- a/examples/app/lib/database/database.g.dart +++ b/examples/app/lib/database/database.g.dart @@ -202,6 +202,8 @@ class $CategoriesTable extends Categories @override Set get $primaryKey => {id}; @override + List> get uniqueKeys => []; + @override Category map(Map data, {String? tablePrefix}) { return Category.fromData(data, prefix: tablePrefix != null ? '$tablePrefix.' : null); @@ -461,6 +463,8 @@ class $TodoEntriesTable extends TodoEntries @override Set get $primaryKey => {id}; @override + List> get uniqueKeys => []; + @override TodoEntry map(Map data, {String? tablePrefix}) { return TodoEntry.fromData(data, prefix: tablePrefix != null ? '$tablePrefix.' : null); @@ -609,6 +613,8 @@ class TextEntries extends Table @override Set get $primaryKey => {}; @override + List> get uniqueKeys => []; + @override TextEntrie map(Map data, {String? tablePrefix}) { return TextEntrie.fromData(data, prefix: tablePrefix != null ? '$tablePrefix.' : null); diff --git a/examples/app/web/index.html b/examples/app/web/index.html index 55ed4806..9a16f36c 100644 --- a/examples/app/web/index.html +++ b/examples/app/web/index.html @@ -29,8 +29,6 @@ - - app