I know this problem is related with dart null safety but i am unable to fix this issue as i am getting this 'Null check operator used on a null value Flutter' error.Please help me to fix this
my code is:
class _ListStudentPageState extends State<ListStudentPage> {
final Stream<QuerySnapshot> studentStream =
FirebaseFirestore.instance.collection('students').snapshots();
@override
Widget build(BuildContext context) {
return StreamBuilder<QuerySnapshot>(
stream: studentStream,
builder:(BuildContext context , AsyncSnapshot<QuerySnapshot> snapshot){
if(snapshot.hasError)
{
print('something went wrong');
}
if(snapshot.connectionState == ConnectionState.waiting)
{
return const Center(
child: CircularProgressIndicator(),
);
}
final List storeDocs =[];
snapshot.data!.docs.map((DocumentSnapshot document){
Map a = document.data() as Map<String , dynamic>;
storeDocs.add((a));
a['id'] = document.id;
}).toList();