0

I have questions table on my Sqflite database but ı can't show them on my Screen.

this all questions in my DatabaseHelper class

Future<List<Map<String, dynamic>>> allQuestions() async {
var db = await _getDataBase();
var sonuc = await db.query(_questionTable, orderBy: '$_columnId DESC'); 
return sonuc;
}

I can read my data with debugPrint but ı cant show them with future

bottom lines are nonfunctional.

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(
  • you should return a `ListView,builder()` instead of a `Column`. Give your full code inside `FutureBuilder` – Saiful Islam Dec 16 '20 at 11:40
  • result.data is empty, even if I use ListView.builder () it doesn't matter because the data will be empty.My problem is Future> qestionFromSqfliteDataBase() method is not working – Yalçın Yıldırım Dec 16 '20 at 11:51

0 Answers0