'FireStore Query does not return records although there is data

Tried to query DB from Flutter with following snippet

await _firestore.collection('products').get().then((docs) => {
    if (docs.docs.isNotEmpty){
        // do something
    }
});

The rules in Firestore are fine as well

rules_version = '2';
service cloud.firestore {
    match /databases/{database}/documents {
        match /{document=**} {
            allow read, write: if true; 
        }
    }
}

But I donot get any data in response, although there is data here: enter image description here



Solution 1:[1]

The user proceeded to stop the app and disconnected from the internet. Then proceed to connect to the internet and ran flutter clean, he then ran the app again and that fixed the issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1