Upgrade to latest `sqlite3` package in example app

This commit is contained in:
Simon Binder 2022-05-04 20:41:15 +02:00
parent c5183deea6
commit 9e2e9c47be
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
4 changed files with 5 additions and 12 deletions

View File

@ -18,20 +18,19 @@ DatabaseConnection connect({bool isInWebWorker = false}) {
return remote(worker.port!.channel());
} else {
return DatabaseConnection.delayed(Future.sync(() async {
// We're using the experimental wasm support in Drift because this gives us
// a recent sqlite3 version with fts5 support.
// We're using the experimental wasm support in Drift because this gives
// us a recent sqlite3 version with fts5 support.
// This is still experimental, so consider using the approach described in
// https://drift.simonbinder.eu/web/ instead.
final response = await http.get(Uri.parse('sqlite3.wasm'));
final fs = await IndexedDbFileSystem.load('/drift/my_app/');
final fs = await IndexedDbFileSystem.open(dbName: 'my_app');
final sqlite3 = await WasmSqlite3.load(
response.bodyBytes,
SqliteEnvironment(fileSystem: fs),
);
final databaseImpl =
WasmDatabase(sqlite3: sqlite3, path: '/drift/my_app/app.db');
final databaseImpl = WasmDatabase(sqlite3: sqlite3, path: 'app.db');
return DatabaseConnection.fromExecutor(databaseImpl);
}));
}

View File

@ -202,8 +202,6 @@ class $CategoriesTable extends Categories
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
List<Set<GeneratedColumn>> get uniqueKeys => [];
@override
Category map(Map<String, dynamic> data, {String? tablePrefix}) {
return Category.fromData(data,
prefix: tablePrefix != null ? '$tablePrefix.' : null);
@ -463,8 +461,6 @@ class $TodoEntriesTable extends TodoEntries
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
List<Set<GeneratedColumn>> get uniqueKeys => [];
@override
TodoEntry map(Map<String, dynamic> data, {String? tablePrefix}) {
return TodoEntry.fromData(data,
prefix: tablePrefix != null ? '$tablePrefix.' : null);
@ -613,8 +609,6 @@ class TextEntries extends Table
@override
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
@override
List<Set<GeneratedColumn>> get uniqueKeys => [];
@override
TextEntrie map(Map<String, dynamic> data, {String? tablePrefix}) {
return TextEntrie.fromData(data,
prefix: tablePrefix != null ? '$tablePrefix.' : null);

View File

@ -17,7 +17,7 @@ dependencies:
intl: ^0.17.0
http: ^0.13.4 # used to load sqlite3 wasm files on the web
sqlite3_flutter_libs: ^0.5.5
sqlite3: ^1.6.1
sqlite3: ^1.7.0
path_provider: ^2.0.9
path: ^1.8.0
riverpod: ^1.0.3

Binary file not shown.