Flutter FutureBuilder return null

399 views
Skip to first unread message

Mustafa ARPACIOĞLU

unread,
May 27, 2020, 6:26:46 PM5/27/20
to Flutter Development (flutter-dev)
when listing the data in my local database with FutureBuilder snapshot return null. I don't listing my data. when I check connection status it is waiting. when debugprint dbHelper.randevuListesiGetir() method, my data listing console screnn but not listing futurebuilder.


class _RandevularState extends State<Randevular> {
 
DatabaseHelper dbHelper;
 
List<Randevu> tumRandevular;
 
@override
 
void initState() {
   
// TODO: implement initState
   
super.initState();

      dbHelper
=DatabaseHelper();
     tumRandevular
=List<Randevu>();
 
}

 
@override
 
Widget build(BuildContext context) {
   
return FutureBuilder(
      future
:dbHelper.randevuListesiGetir() ,
      builder
: (context,AsyncSnapshot<List<Randevu>> snapshot){
       
if(snapshot.connectionState==ConnectionState.done){
          tumRandevular
=snapshot.data;
         
print("data"+snapshot.data.toString());
       
}else if(snapshot.connectionState==ConnectionState.waiting){
         
print("waiting");
       
}else{
         
print("error");
       
}

     
},
   
);
 
}

}


Suzuki Tomohiro

unread,
May 27, 2020, 8:55:18 PM5/27/20
to Mustafa ARPACIOĞLU, Flutter Development (flutter-dev)
Would you add print statement for the case of snapshot ==null?
What does the code print after that?

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/97b72621-a15a-43d0-a1cc-114b2d54d457%40googlegroups.com.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages