Skip to content

Commit

Permalink
Use recommended path in example app
Browse files Browse the repository at this point in the history
  • Loading branch information
simolus3 committed Dec 29, 2024
1 parent ca9b769 commit 7191459
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/lib/snippets/setup/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class OpenFlutter {
static QueryExecutor _openConnection() {
return driftDatabase(
name: 'my_database',
native: DriftNativeOptions(
native: const DriftNativeOptions(
// By default, `driftDatabase` from `package:drift_flutter` stores the
// database files in `getApplicationDocumentsDirectory()`.
databaseDirectory: getApplicationSupportDirectory,
Expand Down
24 changes: 15 additions & 9 deletions examples/app/lib/database/database.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:drift/drift.dart';
import 'package:drift_flutter/drift_flutter.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart' show Colors;
import 'package:path_provider/path_provider.dart';
import 'package:riverpod/riverpod.dart';
import 'connection/connection.dart' as impl;

Expand All @@ -21,16 +22,21 @@ class AppDatabase extends _$AppDatabase {
e ??
driftDatabase(
name: 'todo-app',
native: const DriftNativeOptions(
databaseDirectory: getApplicationSupportDirectory,
),
web: DriftWebOptions(
sqlite3Wasm: Uri.parse('sqlite3.wasm'),
driftWorker: Uri.parse('drift_worker.js'),
onResult: (result) {
if (result.missingFeatures.isNotEmpty) {
debugPrint(
'Using ${result.chosenImplementation} due to unsupported '
'browser features: ${result.missingFeatures}');
}
}),
sqlite3Wasm: Uri.parse('sqlite3.wasm'),
driftWorker: Uri.parse('drift_worker.js'),
onResult: (result) {
if (result.missingFeatures.isNotEmpty) {
debugPrint(
'Using ${result.chosenImplementation} due to unsupported '
'browser features: ${result.missingFeatures}',
);
}
},
),
),
);

Expand Down

0 comments on commit 7191459

Please sign in to comment.