Skip to content

Commit 7191459

Browse files
committed
Use recommended path in example app
1 parent ca9b769 commit 7191459

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

docs/lib/snippets/setup/database.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class OpenFlutter {
5454
static QueryExecutor _openConnection() {
5555
return driftDatabase(
5656
name: 'my_database',
57-
native: DriftNativeOptions(
57+
native: const DriftNativeOptions(
5858
// By default, `driftDatabase` from `package:drift_flutter` stores the
5959
// database files in `getApplicationDocumentsDirectory()`.
6060
databaseDirectory: getApplicationSupportDirectory,

examples/app/lib/database/database.dart

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:drift/drift.dart';
33
import 'package:drift_flutter/drift_flutter.dart';
44
import 'package:flutter/foundation.dart';
55
import 'package:flutter/material.dart' show Colors;
6+
import 'package:path_provider/path_provider.dart';
67
import 'package:riverpod/riverpod.dart';
78
import 'connection/connection.dart' as impl;
89

@@ -21,16 +22,21 @@ class AppDatabase extends _$AppDatabase {
2122
e ??
2223
driftDatabase(
2324
name: 'todo-app',
25+
native: const DriftNativeOptions(
26+
databaseDirectory: getApplicationSupportDirectory,
27+
),
2428
web: DriftWebOptions(
25-
sqlite3Wasm: Uri.parse('sqlite3.wasm'),
26-
driftWorker: Uri.parse('drift_worker.js'),
27-
onResult: (result) {
28-
if (result.missingFeatures.isNotEmpty) {
29-
debugPrint(
30-
'Using ${result.chosenImplementation} due to unsupported '
31-
'browser features: ${result.missingFeatures}');
32-
}
33-
}),
29+
sqlite3Wasm: Uri.parse('sqlite3.wasm'),
30+
driftWorker: Uri.parse('drift_worker.js'),
31+
onResult: (result) {
32+
if (result.missingFeatures.isNotEmpty) {
33+
debugPrint(
34+
'Using ${result.chosenImplementation} due to unsupported '
35+
'browser features: ${result.missingFeatures}',
36+
);
37+
}
38+
},
39+
),
3440
),
3541
);
3642

0 commit comments

Comments
 (0)