title: Cannot write to Firestore from client app when using Firestore Emulator
body: <p>I'm having problems creating documents in Firestore while using Firestore Emulator. Below is the error I see in logs:</p>
  <blockquote>
  <p>W/Firestore(13200): (24.0.1) [WriteStream]: (aa74142) Stream closed with status: Status{code=UNKNOWN, description=null, cause=null}.</p>
  </blockquote>
  <p>In my app, after user signs up, I check if there is a document related to this user. This read operation succeeds, therefore I conclude that I can read from Firestore. If there isn't a document related to the user, a document gets created. This is the point that the code gets stuck. The write operation does not return. It does not throw an exception either.</p>
  <p>I'm using both Authentication and Firestore emulators.</p>
  <p>This problem does not occur all the time. For example in the app, when a new FCM token has been generated, the token is saved into the Firestore and this works without any issues. I can see the document in Firestore Emulator Dashboard. I can also create documents manually using the dashboard.</p>
  <p>The problem occurs both on physical device and Android Emulator. While testing on physical device, I connect to the Firestore Emulator by specifying the IP address of my computer which the Firestore Emulator is running on. On Android Emulator, I provide <code>localhost</code> as the host of the Firestore Emulator.</p>
  <p>I've also created an <a href="https://github.com/FirebaseExtended/flutterfire/issues/8178" rel="nofollow noreferrer">issue</a> in flutterfire repository.</p>
  <p>Output of <code>flutter doctor</code>:</p>
  <pre><code>Doctor summary (to see all details, run flutter doctor -v):
  [✓] Flutter (Channel stable, 2.10.1, on Pop!_OS 21.10 5.15.23-76051523-generic, locale en_US.UTF-8)
  [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc1)
  [✓] Chrome - develop for the web
  [✓] Android Studio (version 2021.1)
  [✓] VS Code (version 1.64.2)
  [✓] Connected device (2 available)
  [✓] HTTP Host Availability
  
  • No issues found!
  </code></pre>
  <p>Versions of <code>cloud_firestore</code> and <code>firebase_core</code> packages:</p>
  <pre><code>cloud_firestore: ^3.1.8
  firebase_core: ^1.12.0
  </code></pre>