简体   繁体   中英

How to get data from an array in flutter?

Im trying to get data from firebase in flutter. Theres my video collection where every videos has an array and I want get that array and save it in a list and then loop over it. But how can I do this?Here is my code at the moment

getusers() async {
    var firestore = FirebaseFirestore.instance;
    List listofarrays = [];
 QuerySnapshot qn=  await firestore
        .collection('videos')
        .get()
        .then((QuerySnapshot querySnapshot) {
      querySnapshot.docs.forEach((doc) {
        setState(() {
                     

         
        });
  

So what I want is getting every array of each video with names Hashtagsforallvideos and then add it into the list listofarrays. heres my database在此处输入图像描述

Im trying to get data from firebase in flutter. Theres my video collection where every videos has an array and I want get that array and save it in a list and then loop over it. But how can I do this?Here is my code at the moment

getusers() async {
    var firestore = FirebaseFirestore.instance;
    List listofarrays = [];
 QuerySnapshot qn=  await firestore
        .collection('videos')
        .get()
        .then((QuerySnapshot querySnapshot) {
      querySnapshot.docs.forEach((doc) {
        setState(() {
                     

         
        });
  

So what I want is getting every array of each video with names Hashtagsforallvideos and then add it into the list listofarrays. heres my database在此处输入图像描述

Im trying to get data from firebase in flutter. Theres my video collection where every videos has an array and I want get that array and save it in a list and then loop over it. But how can I do this?Here is my code at the moment

getusers() async {
    var firestore = FirebaseFirestore.instance;
    List listofarrays = [];
 QuerySnapshot qn=  await firestore
        .collection('videos')
        .get()
        .then((QuerySnapshot querySnapshot) {
      querySnapshot.docs.forEach((doc) {
        setState(() {
                     

         
        });
  

So what I want is getting every array of each video with names Hashtagsforallvideos and then add it into the list listofarrays. heres my database在此处输入图像描述

Im trying to get data from firebase in flutter. Theres my video collection where every videos has an array and I want get that array and save it in a list and then loop over it. But how can I do this?Here is my code at the moment

getusers() async {
    var firestore = FirebaseFirestore.instance;
    List listofarrays = [];
 QuerySnapshot qn=  await firestore
        .collection('videos')
        .get()
        .then((QuerySnapshot querySnapshot) {
      querySnapshot.docs.forEach((doc) {
        setState(() {
                     

         
        });
  

So what I want is getting every array of each video with names Hashtagsforallvideos and then add it into the list listofarrays. heres my database在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM