草庐IT

sqlite - flutter SQflite : How to solve unhandled exception?

在我的应用程序中,我确实想使用sqflite插件保存一些数据,但它一直向我抛出错误:Unhandledexception:type'_InternalLinkedHashMap'isnotasubtypeoftypeMap'where_InternalLinkedHashMapisfromdart:collection-Mapisfromdart:core-Stringisfromdart:core这是我重新生成错误的代码:Rezepte.dart我在其中处理数据库中名为Rezepte的表。classRezepte{Rezepte();intid;Stringname;intperso

sqlite - Flutter Sqflite 多表模型

我已经阅读了许多关于如何在Flutter中实现Sqflite的教程和示例。其他所有示例都是仅使用一个模型或数据库表完成的。如这些教程中所定义:https://pub.dartlang.org/packages/sqflitehttps://www.developerlibs.com/2018/07/flutter-sqlite-database-example.htmlhttp://camposha.info/flutter/sqflite-insert-select-show据我所知,我们需要创建与表一样多的模型和助手。对于每个数据库表,将有一个model.dart文件和一个help

dart - 如何在 Dart/Flutter 中捕获 sqflite DatabaseException

我未能成功捕获引发数据库异常的sqfliteSQL错误。注意:这是一个Future和async。示例代码FuturegetData()async{DirectorydocumentsDirectory=awaitgetApplicationDocumentsDirectory();Stringpath=join(documentsDirectory.path,globals.databaseName);Databasedb=awaitopenDatabase(path);Listresults=awaitdb.rawQuery("malformedexampleofsqlonpurpo

android - Flutter - SQflite '_InternalLinkedHashMap<dynamic, dynamic>' 不是类型 'Map<String, dynamic>' 的子类型

我正在尝试在sqflite数据库中保存一些带有flutter的数据,但我仍然收到一条错误消息:[ERROR:flutter/shell/common/shell.cc(181)]DartError:Unhandledexception:type'_InternalLinkedHashMap'isnotasubtypeoftype'Map'错误说错误在这个函数内部:FutureinsertRecipe(RecipesDBrecipe)async{varcount=Sqflite.firstIntValue(await_db.rawQuery("SELECTCOUNT(*)FROMreci

json - 如何使用 SQFLite 或 Moor 库将 JSON 数据存储到 flutter 中的数据库表中

如何在flutter应用程序的数据库中插入字符串列表,我尝试通过将json数组编码为字符串来将其保存为字符串数据类型,但是技能数组每次都需要显式解码,如下所示,每当我需要从数据库返回对象。ListuserResponse=awaittempDatabase.allItems;jsonData=Result.fromJson({"name":userResponse[0].name,"skills":jsonDecode(userResponse[0].skills)});这是我的json响应{"result":[{"name":"SidhantRajora","skills":["C+

dart - 如何使用 Flutter SQFlite 获取数据库表中的行数

如何在Flutter中获取数据库表的行数。我正在使用SQFlite插件。我假设它类似于Android,但Android具有DatabaseUtils.queryNumEntries(db,TABLE_NAME)。SQFlite有类似的东西吗?我将尽我所知在下面回答这个问题,但如果有更好的答案,我会很高兴。 最佳答案 你可以使用intcount=Sqflite.firstIntValue(awaitdb.rawQuery('SELECTCOUNT(*)FROMtable_name'));其中db是SQFlite数据库。来源:我找到了这

database - 如何在flutter中将图像数据保存到sqflite数据库以进行持久化

我正在构建一个Flutter应用程序,我希望在其中保持数据离线。我正在使用相机或画廊图像选择器捕获图像,并且能够将该图像存储到Fileimage变量中。File_avatarImg;void_getImage(BuildContextcontext,ImageSourcesource){ImagePicker.pickImage(source:source,maxWidth:400.0,maxHeight:400.0,).then((Fileimage){_avatarImg=image;});}这非常有效,但是我的问题是,我将如何存储此图像以进行持久性?我应该在图像所在的手机中存储一