Home > Back-end >  how to retrieve data from Firebase on card and fetch data to detail screen? [closed]
how to retrieve data from Firebase on card and fetch data to detail screen? [closed]

Time:09-17

here is card list

in pic two I want to show data of that card I tap

CodePudding user response:

you can retrieve data like this

you can create a model for the response you are getting

Get Data

Define the path from where you want to get data

eg.

FirebaseFirestore fireStore = FirebaseFirestore.instance;

This will return data in stream.

 fireStore.collection("TABLE_NAME").snapshots().map((event) => event.docs.map((e) => ExampleModel.fromJson(e.data())).toList());

so your function will look something like this.

Stream<List<ExampleModel>> getExampleData() {
return fireStore.collection("TABLE_NAME").snapshots().map((event) => event.docs.map((e) => ExampleModel.fromJson(e.data())).toList());

}

  • Related