I think the problem resides here.
_databaseHelper.tumMaliyetler().then((tumAnalizleriTutanMapListesi) {
for (Map<String, dynamic> okunanAnalizMapi
in tumAnalizleriTutanMapListesi) {
maliyetListesi
.add(Maliyet.dbdenOkudugunMapiObjeyeDonustur(okunanAnalizMapi));
}
debugPrint("adas");
debugPrint(malzemeAdi.text.toString());
});
You are resolving a future here, which means that this code will be "sometime" executed in the future.
I would try the solution shown here: https://stackoverflow.com/a/51901192/9479695
@override
void initState() {
super.initState();
asyncMethod();
}
void asyncMethod() async {
final tumAnalizleriTutanMapListesi = await _databaseHelper.tumMaliyetler();
// ... fill maliyetListesi here
}
I would also suggest reading about async / await in dart here https://dart.dev/codelabs/async-await
Also about how to use them in Flutter with the StreamBuilder here https://api.flutter.dev/flutter/widgets/StreamBuilder-class.html and FutureBuilder here https://api.flutter.dev/flutter/widgets/FutureBuilder-class.html