getData (ordering)

Firestore.instance
        .collection('collection_name')
        .orderBy('field_name', descending: true)
        .orderBy('field_name')

getData (all code)

  • init state
  • sub collection
  • data ordering
  
  void initState() {
    super.initState();
    
    ...

    Firestore.instance
        .collection('collection_name')
        .document(_user.uid)
        .collection('collection_name')
        .orderBy('field_name', descending: true)
        .orderBy('field_name')
        .snapshots()
        .listen((data) {
      setState(() {
        _localEvents.clear();
        var datas = data?.documents ?? [];
        ...
      }
    }
  }

cf

https://firebase.google.com/docs/firestore/query-data/order-limit-data?hl=ko

profile
𝙸 𝚊𝚖 𝚊 𝚌𝚞𝚛𝚒𝚘𝚞𝚜 𝚍𝚎𝚟𝚎𝚕𝚘𝚙𝚎𝚛 𝚠𝚑𝚘 𝚎𝚗𝚓𝚘𝚢𝚜 𝚍𝚎𝚏𝚒𝚗𝚒𝚗𝚐 𝚊 𝚙𝚛𝚘𝚋𝚕𝚎𝚖. 🇰🇷👩🏻‍💻

0개의 댓글