title: Firestore.getInstance(): how to use?
body: <p>Firebase Firestore provides the <code>getInstance()</code> method, which opens a socket (only one, at any time of execution of the app) and instanciates the Firestore client.</p>
  
  <p>I would want to query and store data, using or not listeners (to get realtime updates, etc.). If I call <code>getInstance</code> as soon as I need to query or store, or if I store this instance in a static class when my app starts and then use this static class attribute as soon as I need to query or store: these 2 cases are technically the same. Because Google uses singleton pattern (<code>getInstance()</code>).</p>
  
  <p>But am I missing something? Is it actually safe to store this instance as a static class attribute, and use it when I need it? And is it really safe to call <code>getInstance</code> whenever I need it? <strong>To be more explicit: between 2 calls to <code>getInstance()</code> (or between 2 accesses to the static class attribute), <em>i.e.:</em> between 2 points of execution time, is there any risk to loose network connection, socket connection, realtime listeners (snapshots) connection, etc. ?</strong></p>
  
  <p>If yes: How to handle these problem(s)?</p>