android-studio - 使用 FutureBuilder 在 Sqflite 中列出数据
问题描述
我的 Sqflite 数据库上有问题表,但我无法在我的屏幕上显示它们。
我的 DatabaseHelper 类中的所有问题
Future<List<Map<String, dynamic>>> allQuestions() async {
var db = await _getDataBase();
var sonuc = await db.query(_questionTable, orderBy: '$_columnId DESC');
return sonuc;
}
我可以用 debugPrint 读取我的数据,但我不能在未来显示它们
底线是无效的。
Future<List<Questions>> qestionFromSqfliteDataBase() async {
List<Questions> a;
List<Questions> questionFromDb =
await _databaseHelper.allQuestions().then((mapListAllQuestions) {
for (Map m in mapListAllQuestions) {
a.add(Questions.dbdenOkudugunMapiObjeyeDonustur(m));
}
}).catchError((hata) => print("hata" + hata));
questionFromDb=a;
return questionFromDb;
}
child: FutureBuilder(
future: qestionFromSqfliteDataBase(),
builder: (context, sonuc) {
debugPrint(sonuc.hasData.toString());
if (sonuc.connectionState == ConnectionState.done &&
sonuc.hasData) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
解决方案
推荐阅读
- palantir-foundry - 如何在 Slate 中有条件地设置表格单元格、行或列的样式?
- css - Reactjs Styled-components 无法正常工作
- google-apps-script - 跳过谷歌表格中的空单元格以获取带有超链接的文本脚本
- r - 有没有办法使用部分匹配的字符串进行绑定?
- r - 如何根据列表名称更改 colnames?
- docker - Visual Studio Code Remote - 容器:更改默认根目录
- palantir-foundry - 如何从代码存储库中找到 Foundry API?
- wordpress - 从 WordPress 博客迁移到 React
- javascript - 记录不同的数组
- palantir-foundry - 如何格式化板岩条形图的“悬停”工具提示中的文本?