-1

I've created a portion of code that call firebase database in order to fetch data. this data is used below to do other things. the problem is the code under the call is run before the data is fetched. is there a way to run it in sequence ?

1 Answers1

1

Data is loaded from Firebase asynchronously. Any code that requires the data must be called from within the onDataChange (for Realtime Database) or onComplete/onEvent (for Firestore) listeners.

For some good examples of how to do this, see:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807