[英]Can anyone help how to implement Sqflite for the default flutter counter App?
我可以為 sqflite 制作數據庫助手,也可以用 sqflite 進行粗略的操作。 但是我在保存 int 時遇到了一些問題。 這將增加。 假設默認的 flutter 計數器 App。 我想將遞增的 int 保存在數據庫中,然后獲取值。 如果有人對此有所了解並與我分享,這對我來說將是一個很好的學習。 謝謝
這就是 sqllite 表的創建方式
Future<Database> init() async {
Directory directory = await getApplicationDocumentsDirectory(); //returns a directory which stores permanent files
final path = join(directory.path,"pdf.db"); //create path to database
return await openDatabase( //open the database or create a database if there isn't any
path,
version: 1,
onCreate: (Database db,int version) async{
CREATE TABLE PDF(
id INTEGER PRIMARY KEY AUTOINCREMENT,
email TEXT,
name TEXT,
password TEXT,
confrimpassword TEXT,
path TEXT)"""
);
});
}
這里 id 是增量 num 它將自動增量生成
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.