我正在将数据插入我的数据库并收到以下错误...
flutter: Moor: Sent INSERT INTO add_cash (name, amount, date, frequency, is_deleted) VALUES (?, ?, ?, ?, ?) with args [income, 100000, 1573102800, once, 0]
问号是否表示数据未插入数据库
这是将数据发送到数据库的按钮
CupertinoButton.filled(
onPressed: () {
scakey.currentState.onItemTapped(1);
createAddCash();
},
child: Text('ADD CASH'),
),
void createAddCash() async {
final database = Provider.of<AppDatabase>(context);
final task = AddCashData(
name: oneController.text,
amount: int.parse(twoController.text),
date: selectedDate,
frequency: selectedItem,
isDeleted: false);
database.insertAddCash(task);
}
这是我的数据库
class AddCash extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get name => text()();
IntColumn get amount => integer()();
DateTimeColumn get date => dateTime()();
TextColumn get frequency => text()();
BoolColumn get isDeleted => boolean()();
}
@UseMoor(tables: [AddCash])
class AppDatabase extends _$AppDatabase {
AppDatabase()
// Specify the location of the database file
: super(
(FlutterQueryExecutor.inDatabaseFolder(
path: 'db.sqlite',
// Good for debugging - prints SQL in the console
logStatements: true,
)),
);
@override
int get schemaVersion => 1;
Future insertAddCash(AddCashData addCashData) =>
into(addCash).insert(addCashData);
}