我使用代码更新了sqlite数据库,(此方法正常工作)
updateSubmitRequest(int id, String status) async {
var db = await db1;
await db.rawUpdate('''
UPDATE submitRequestTable
SET status = ?
WHERE id = ?
''', [status, id]);
}
update.dart 我更新了这样的状态,
print('before update ${submitRequest[i].status}');
await HelperDatabase1()
.updateSubmitRequest(submitRequest[i].id, 'Pending');
print('after update ${submitRequest[i].status}');
显示
List submitRequest = (await HelperDatabase1().displaySubmitRequest());
方法
displaySubmitRequest() async {
var db = await db1;
final List<Map<String, dynamic>> maps =
await db.query('submitRequestTable');
return List.generate(maps.length, (i) {
return SubmitRequestModel(
id: maps[i]['id'],
equipmentId: maps[i]['equipmentId'],
woDescriptionId: maps[i]['woDescriptionId'],
details: maps[i]['details'],
priorityId: maps[i]['priorityId'],
workTypeId: maps[i]['workTypeId'],
sourceId: maps[i]['sourceId'],
fileName: maps[i]['fileName'],
filepath: maps[i]['filepath'],
isOffline: maps[i]['isOffline'],
systemDate: maps[i]['systemDate'],
username: maps[i]['username'],
subItemId: maps[i]['subItemId'],
status: maps[i]['status']);
});
}
在我的LogCat输出中,
I/flutter (15908): before update success I/flutter (15908): after update success
为什么不更改为“待处理”? 我的更新方法可以正常运行。