Hi flutter community,
I'm trying to pass a Document Snapshot to another view so I can display all its properties. I can declare and initialize the constructor for this Document Snapshot in the Details Page. However, when trying to pass this Document Snapshot, I get Undefined name 'snapshot'.
Here's how I'm 'receiving' my data inside the DetailsPage
final DocumentSnapshot productId;
ProductsDetailsPage({this.productId});
This is what I'm trying in the ProductsContainer and the error I'm getting:
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
navigateToDetailsPage(snapshot.data[index]);
},
child: Container(
child: FutureBuilder<QuerySnapshot>(
future: widget.value.get(),
builder: (context, snapshot) {...
And the method "navigateToDetailsPage"
class _ProductContainerState extends State<ProductContainer> {
navigateToDetailsPage(DocumentSnapshot productId) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ProductsDetailsPage(
productId: productId,
),...
----------------------------------------
I guess the core of my question is, isn't the navigateToDetailsPage(snapshot.data[index]);
The same one I'm using to fetch and read all my data in my build method?
// ex:
return Listview(
children: snapshot.data.docs.map((document) {
return Container(
Thanks community! Any guidance would be very helpful!