Reputation: 1049
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
FirebaseFirestore FS = FirebaseFirestore.instance;
CollectionReference TC = FirebaseFirestore.instance.collection("oneSignal");
var docs = TC.doc("xcG9kfCWnUK7QKbK37qd");
var response = await docs.get();
var veriable = response.data();
print(veriable);
I am trying to pull data from FireBase FireStore with this code. But I am getting an error like this:
Rule codes:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /oneSignal/{signalId} {
allow write;
}
}
}
How can I solve it? Thanks in advance for the help.
Upvotes: 0
Views: 38
Reputation: 80904
Add allow read
to the rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /oneSignal/{signalId} {
allow read, write: if true;
}
}
}
Upvotes: 1