问题描述
我一直在寻找以波动的方式将csv导入数据库。但不幸的是,我找不到与此案有关的文章。所以我想知道是否有一种方法可以将csv导入数据库。如果是,我该如何实现?就我而言,我打开文件选择器,并想要导入csv文件。我可以轻松地以Kotlin方式进行操作,但不能以颤抖的方式进行操作。我将不胜感激。
I have been searching to import csv to database in flutter way. But unfortunately, I cannot find articles related to this case. So I wonder if there is a way to import csv to database. If yes, how can I achieve that? For my case, I open the file picker and want to import csv file. I can easily do it in Kotlin way but not in a flutter way. I would appreciate any help.
推荐答案
嗯,这并不简单。
您通常会使用或,以便使用您的结果填充数据库字段。
Then you could use some helper method like mentioned here => https://stackoverflow.com/a/56507307/1737811 in order to populate the database fields with your result.
那样,您将传递您的表名
,当然还有您的列表
包含刚解码的CSV中的值。
That way you'd pass your tablename
, and of course your List
containing the values from the CSV that you've just decoded.
这篇关于有什么办法以Flutter方式将CSV文件导入Sqlite数据库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!