0
I need a gigantic help, I’m having a hard time passing data from one screen to another on Flutter, I’m using Firebase with Firestore on a stream, but I don’t know what I put in Navigator, and how to make the variables for the second screen take the data from the first... Succor!
I need to pass on the data from Productlist to the Productscreen....
Github link if you want to analyze https://github.com/alexandrechoske/BigTudoStore_Flutter
Tetei perform like this but he is not recognizing on Productscreen..
class ProductScreen extends StatefulWidget {
ProductScreen({this.ref, this.descr}); /* Esse é o creator que vai receber os dados */
final String ref;
final String descr;
@override
_ProductScreenState createState() => _ProductScreenState();
}
class _ProductScreenState extends State<ProductScreen> {
@override
Widget build(BuildContext context) {
return Container(
child: Card(
child: ListTile(
title: Text(descr)
),
),
);
}
}
and on onTap:
onTap: () {Navigator.push(context, MaterialPageRoute(builder: (context) => ProductScreen(ref: snapshot["ref"], descr: snapshot["descr"])));},
But it accuses an Undefined error name 'descr' on Productscreen.
Tks!!
What about beauty? Put in your question what you’ve done to try to pass the data between the screens, it’s just you edit your question and ask... Don’t just use links, because one day you can take your source from there!
– Matheus Ribeiro
Sorry...but I’ve tried so many things that I wouldn’t even know how to describe here hehehe so I thought posting the code would be more relevant to the situation....
– Choske
Yes, the code is relevant, but put an example as in my answer, so your question will not be closed and we will be able to help you better.
– Matheus Ribeiro