[Flutter] firebase data 가져오기

제리·2022년 1월 8일
0
CollectionReference _collectionRef =
    FirebaseFirestore.instance.collection('collection');

Future<void> getData() async {
    // Get docs from collection reference
    QuerySnapshot querySnapshot = await _collectionRef.get();

    // Get data from docs and convert map to List
    final allData = querySnapshot.docs.map((doc) => doc.data()).toList();

    print(allData);
}
var data = FirebaseFirestore.instance.collection('users').get();
              data.then((value) => print(value.docs.map((doc)=>doc.data()).toList()));
profile
iOS 준비중

0개의 댓글