title: Improve Firestore Offline cache - Android
body: <p>So half of my application relies quite a bit on Firestore.</p>
  
  <p>Sometimes, it takes quite a long time, like <code>5000ms</code> or more to load my documents. If it was images or something else maybe I'd understand but it's mainly strings or Ints...</p>
  
  <p>Any ideas on how I could improve this?</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <p><strong>EDIT:</strong>
      db.collection("usersAuth/${FirebaseAuth.getInstance().uid!!}/KitLists").get().addOnSuccessListener { snapshot -></p>
  
  <pre><code>        for (document in snapshot.documents) {
              val data = document
  
              val kitName = data.id
              firstKitList.add(kitName)
          }
  
         mainListViewAdapter.notifyDataSetChanged()
      }
  </code></pre>
  
  <hr>
  
  <p>EDIT2</p>
  
  <p>So, I adapted it, but I have an unresolved error on <code>snapshot</code>.</p>
  
  <pre><code>db.collection("usersAuth/${FirebaseAuth.getInstance().uid!!}/KitLists").addSnapshotListener(object : EventListener&lt;QuerySnapshot&gt; {
          override fun onEvent(@Nullable value: QuerySnapshot, @Nullable e: FirebaseFirestoreException?) {
              if (e != null) {
                  Log.w("TAG", "Listen failed.", e)
                  return
              }
  
              for (document in snapshot.documents) {
              val data = document
  
              val kitName = data.id
  
              firstKitList.add(kitName)
  
          }
  
         mainListViewAdapter.notifyDataSetChanged()
          }
      })
  </code></pre>
  
  <p>this is the error <img src="https://i.stack.imgur.com/emvYp.png" alt="snapshot error"></p>