Flutter 在 Ubuntu Linux 中找不到 SQFLite 数据库路径

发布于 2025-01-12 22:50:35 字数 805 浏览 2 评论 0原文

我正在开发一个笔记应用程序并在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甲如呢乙后呢 2025-01-19 22:50:35

Linux 不支持 sqflite 插件,您需要使用适用于 Linux 上的 flutter 和 dart VM 的 sqflite_common_ffi 软件包。更多信息请此处

sqflite plugin is not supported on linux, you need to use the sqflite_common_ffi package that works both for flutter and dart VM on linux. More information here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文