Emir Bolat
Emir Bolat

Reputation: 1049

Can't pull data from Dart Flutter FireBase

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:

enter image description here


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

Answers (1)

Peter Haddad
Peter Haddad

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

Related Questions