floor
floor copied to clipboard
Could not use on linux
no handler found for channel com.tekartik.sqflite
Seems to get the correct ffi implementation but throws everytime this error.
Which libraries are you using and what're their versions? Have you run flutter packages pub upgrade
?
no handler found for channel com.tekartik.sqflite
Seems to get the correct ffi implementation but throws everytime this error.
@erikseifert I have solved the problem modyfied method build()
in class _$AppDatabaseBuilder
.
not use sqfliteDatabaseFactory.getDatabasePath
but path_provider
to get path as following.
@vitusortner hope you fix it in plugin code.
/// import path_provider
import 'package:path_provider/path_provider.dart' as path_provider;
/// Creates the database and initializes it.
Future<AppDatabase> build() async {
var path = ':memory:';
if (name != null) {
if (Platform.isLinux || Platform.isMacOS || Platform.isWindows) {
path = normalize(join((await path_provider.getApplicationDocumentsDirectory()).path, 'myAppName', name));
} else {
path = await sqfliteDatabaseFactory.getDatabasePath(name);
}
}
final database = _$AppDatabase();
database.database = await database.open(
path,
_migrations,
_callback,
);
return database;
}
i found another solution. just use setDatabasesPath
, and all work fine.
import 'package:sqflite/sqflite.dart' as sqflite;
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:sqflite/src/factory_mixin.dart' as impl;
sqflite.databaseFactory = databaseFactoryFfi;
final factory = sqflite.databaseFactory as impl.SqfliteDatabaseFactoryMixin;
factory.setDatabasesPath("your/app/path");
Does this problem still exist?