Let's say we have ListView.bulider which gets data from Firstore.
Widget build(BuildContext context) {
return FutureBuilder(
future: FirebaseFirestore.instance.collection('users').get(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) {
return const Expanded(child: SizedBox()) ;
}
return ListView.builder(
itemCount: snapshot.data!.docs.length ,
itemBuilder: (context, int index) {
DocumentSnapshot documentSnapshot = snapshot.data!.docs[index];
return ListView.builder(
itemCount: snapshot.data!.docs.length ,
itemBuilder: (context, int index) {
DocumentSnapshot documentSnapshot = snapshot.data!.docs[index];
return Text(documentSnapshot['products'])
}
);
}
}
Ok. I just read this data which is products .. and then I open the same page again where Future.Bulder is located into stfl class, Will this count as a new read? Even if the data has not changed
in other words, Since stfl class will fetch the data again, will a new reading be calculated every time the user opens the same page many times?
and the same with StreamBuilder?
Should I avoid this with software intervention So that I fetch the data once somehow, such as get data for once at beginning of the app lunch instead of getting them into the general class which users browsing it many times?