mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
Switch to more_ffi
This will be required to run the database in a background isolate.
This commit is contained in:
parent
59035bf2b0
commit
00def5382e
2 changed files with 13 additions and 3 deletions
|
|
@ -1,6 +1,10 @@
|
||||||
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:moor_flutter/moor_flutter.dart';
|
import 'package:moor/moor.dart';
|
||||||
|
import 'package:moor_ffi/moor_ffi.dart';
|
||||||
|
import 'package:path/path.dart' as p;
|
||||||
|
import 'package:path_provider/path_provider.dart' as pp;
|
||||||
|
|
||||||
part 'database.g.dart';
|
part 'database.g.dart';
|
||||||
|
|
||||||
|
|
@ -36,7 +40,11 @@ class PerformanceModel {
|
||||||
)
|
)
|
||||||
class Database extends _$Database {
|
class Database extends _$Database {
|
||||||
Database(String fileName)
|
Database(String fileName)
|
||||||
: super(FlutterQueryExecutor.inDatabaseFolder(path: fileName));
|
: super(LazyDatabase(() async {
|
||||||
|
final dir = await pp.getApplicationDocumentsDirectory();
|
||||||
|
final file = File(p.join(dir.path, fileName));
|
||||||
|
return VmDatabase(file);
|
||||||
|
}));
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get schemaVersion => 1;
|
int get schemaVersion => 1;
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,10 @@ environment:
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
moor_flutter:
|
moor:
|
||||||
|
moor_ffi:
|
||||||
path:
|
path:
|
||||||
|
path_provider:
|
||||||
rxdart:
|
rxdart:
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue