1

Yasterday(12.10.2020) my code was warking. But today he writes error.

doc name is correct. Thanks.

Future loadDataQuest() async {
  while (i < 10) {
    var fen = await FirebaseFirestore.instance
        .collection('questions')
        .doc(notSee[i])
        .get()
        .asStream()
        .map((DocumentSnapshot doc) => Quest.fromJson(doc.id, doc.data()))
        .toList();
    quest.add(fen[0]);
    i++;
  }
  print(quest);
}

error:

W/Firestore(10953): (21.4.3) [Firestore]: Listen for Query(target=Query(questions/5WlbNnrXMCM8CNrnhBxl order by __name__);limitType=LIMIT_TO_FIRST) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}
E/flutter (10953): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: [cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.

E/flutter (10953): #8      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart)
E/flutter (10953): <asynchronous suspension>
Kirill_Z
  • 158
  • 5

1 Answers1

2

true answer by Sai Gopi Me

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

change to this

rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
 match /{document=**} {
  allow read, write: if request.auth != null;
  }
 }
}
Kirill_Z
  • 158
  • 5
  • Be careful with these rules, as they allow any authenticated user to **fully read and write the entire database**, which is probably not what you want for a production app. – Doug Stevenson Oct 12 '20 at 16:06