Flutter 在 Ubuntu Linux 中找不到 SQFLite 数据库路径
我正在开发一个笔记应用程序并在 Ubuntu 20.04 中使用 VS code 我已经集成了 SQFLite 和路径插件,但我遇到了异常
MissingPluginException (MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite))
这是插件的集成
sqflite: ^2.0.2
path: ^1.8.0
这些是这些插件的导入
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
这是我访问数据库的方式 我尝试
Database db = await openDatabase(join(await getDatabasesPath(), "notes.db"),
onCreate: ((db, version) async {
await db.execute('''
CREATE TABLE $tableName (
id INTEGER PRIMARY KEY AUTOINCREMENT,
$col1Name TEXT,
$col2Name TEXT,
$col3Name DATE
)
''');
}), version: 1);
过 flutter clean
但它也不起作用
I am working on a notes app and using VS code in Ubuntu 20.04 I have integrated the SQFLite and path plugins but I am getting the exception
MissingPluginException (MissingPluginException(No implementation found for method getDatabasesPath on channel com.tekartik.sqflite))
Here is the integration of plugins
sqflite: ^2.0.2
path: ^1.8.0
These are the imports for these plugins
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
And here is the way I am accessing databases paths
Database db = await openDatabase(join(await getDatabasesPath(), "notes.db"),
onCreate: ((db, version) async {
await db.execute('''
CREATE TABLE $tableName (
id INTEGER PRIMARY KEY AUTOINCREMENT,
$col1Name TEXT,
$col2Name TEXT,
$col3Name DATE
)
''');
}), version: 1);
I have tried flutter clean
but it is also not working
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Linux 不支持
sqflite
插件,您需要使用适用于 Linux 上的 flutter 和 dart VM 的sqflite_common_ffi
软件包。更多信息请此处sqflite
plugin is not supported on linux, you need to use thesqflite_common_ffi
package that works both for flutter and dart VM on linux. More information here