title: Firebase how to detect if cached data is available
body: <p>I have an application that pulls some simple data from Firebase Realtime Database, and to make things simple here is the flow that I want to have.</p>
  
  <p><strong>If phone is connected to the internet:</strong></p>
  
  <ul>
  <li>Get the data from the firebase database</li>
  </ul>
  
  <p><strong>If phone is offline</strong></p>
  
  <ul>
  <li>If there is data in firebase cache -> get data from cache
  
  <ul>
  <li>If there is nothing in firebase cache -> show some default data stored locally in app</li>
  </ul></li>
  </ul>
  
  <p>The problem is that I don't see possible way to detect if data is available in firebase cache. So when phone is offline I cannot see if I should display the locally stored data or cache from firebase database.</p>