I'm not sure if I got the snapshot thing in Flutter right. Therefore I would like to ask you guys if you aggree my thoughts about snapshot or not.
Let's say I have the FutureBuilder below:
FutureBuilder(
future: someFutureFunction(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting)
return Center(child: CircularProgressIndicator());
else
return Text(counter.toString());
}),
For example someFutureFunction()
returns Future<String>
... Is the snapshot
inside the call-back in FutureBuilder(builder: (context, snapshot){}
needed to access the returned value (Future<String>
) of someFutureFunction()
??
I just wand to make sure if I got it right before saving wrong information in my mind :)
Thanks
snapshot is the most recent interaction with your API for example, if you just have sent your request until the answer comes connectionState is in waiting and if the response comes data in snapshot will be filled....and you asked question and answer to that is yes