'Firebase Read Data Issue (Bad state: Snapshot has neither data nor error)
Showing this problem every time suddenly, There was no issue at first. AVD can run app but in physical device its not even running
Column(
children: [
Container(
padding: const EdgeInsets.only(left: 5, right: 5),
width: double.infinity,
height: MediaQuery.of(context).size.height / 8,
child: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection('productCategory').snapshots(),
builder: ( context, snapshot,){
if(snapshot.hasError){
return const Center(
child: CircularProgressIndicator(),
);
}
final listData = snapshot.requireData;
return ListView.separated(
scrollDirection: Axis.horizontal,
separatorBuilder: (context, index) => const SizedBox(
width: 10,
),
itemCount: listData.size,
itemBuilder: (context, index) {
return CategoryViewHome(
listData.docs[index]['categoryName'],
listData.docs[index]['imageLink']);
},
);
},
),
),
======== Exception caught by widgets library ======================================================= The following StateError was thrown building StreamBuilder<QuerySnapshot<Object?>>(dirty, state: _StreamBuilderBaseState<QuerySnapshot<Object?>, AsyncSnapshot<QuerySnapshot<Object?>>>#0529c): Bad state: Snapshot has neither data nor error
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|