user14624595
user14624595

Reputation: 1084

Firebase Emulator Firestore not connecting to flutter

I have set up my firebase emulator up an running enter image description here

On my main programm, at the start of my flutter web app I have the following code:

void main() async {

  WidgetsFlutterBinding.ensureInitialized();
   await Firebase.initializeApp();

  FirebaseFirestore.instance.settings = Settings(
    host: '127.0.0.1:8080',
    sslEnabled: false,
  );

Yet when I try to get the document I get the following error:

Failed to get Document because the client is offline

My firebase.json is the following:

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "hosting": {
    "public": "build/web",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  },
  "emulators": {
    "firestore": {
      "port": 8080
    },
    "hosting": {
      "port": 5000
    },
    "ui": {
      "enabled": true
    }
  }
}

Upvotes: 0

Views: 1039

Answers (1)

user14624595
user14624595

Reputation: 1084

Turns out everything was set up correctly. The reason I could not communicate with the Firebase Emulator was my Karspersky antivirus. If anyone else has the same issue try to disable your additional antivirus.

Upvotes: 2

Related Questions