0

enter image description here


enter image description here

I need to fetch documents that 'uid', isEqualTo: 'IeXbRCpmB8ejUdYh7nn4IQ2HgUC3'

Above list is containing maps.

How can I do this on flutter?

I tried below code but it's giving No Data as output.

StreamBuilder<QuerySnapshot>(
      stream: FirebaseFirestore.instance
          .collection('abc')
          .where('list.uid', isEqualTo: 'ijQS0rKB4aOJSoTKy1zvmy8O9me2')
          .snapshots(),
      builder: (context, snapshot) {
        if (snapshot.hasError) {
          return const Center(child: Text('Something wrong!'));
        }

        if (snapshot.connectionState == ConnectionState.waiting) {
          return const Center(child: CircularProgressIndicator());
        }

        if (snapshot.data!.size == 0) {
          return const Center(
            child: Text('No Data'),
          );
        }

        return const Center(child: Text('Done'));
      },
    )

How do I perform this query?

Kvu
  • 169
  • 9
  • You can't. You will have to use one of the alternatives in the duplicates. – Doug Stevenson Nov 03 '22 at 03:24
  • While you can query an array for complete matches (with `array-contains`), you can't query on a partial match of an item in an array. If you want to be able to query on just the UID, consider having an additional field (e.g. `listUIDs`) with just those values and then using `array-contains` on that. – Frank van Puffelen Nov 03 '22 at 03:24

0 Answers0