I have this widget
StreamBuilder(
stream:
FirebaseFirestore.instance.collection('HouseDetails').snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
}
return Expanded(
child: ListView(
children: snapshot.data.docs.map<Widget>((document) {
return _buildHouse(context, document);
}).toList(),
physics: BouncingScrollPhysics(),
),
);
});
Now the _buildHouse builds a basic screen which has an onTap functionality. I am passing the QueryDocumentSnapshot document to another screen using MaterialPageRoute.
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => DetailsScreen(house: document),
),
);
},
the line builder: (_) => DetailsScreen(house: document), throws the error
The following _TypeError was thrown building DetailsScreen(dirty, state: _DetailsScreenState#cc47a):
I/flutter ( 5479): type 'List<dynamic>' is not a subtype of type 'List<String>'
I/flutter ( 5479): The relevant error-causing widget was:
I/flutter ( 5479): DetailsScreen
What goes wrong here?