How does FlutterFlow utilize Listeners for Firestore?

As I think about some basic optimizations for my app, I feel like I need to better understand how FlutterFlow handles listeners. For example, there may be cases where I want to signal to a client that they should refresh a cache, or something of the sort. This leads me to two main questions:

1 - is FlutterFlow always listening to the signed-in user's document?

I notice the signed-in user's document always seems accessible via custom actions and from just about anywhere else in the interface. Is this because FlutterFlow is always listening to the user's document and receives any updates in real-time?

If it is always listening to the user's document, I'm also curious whether this means it's performing a new query for the user document on each page, or if the listener lives in a higher-level widget that is outside of page.

2 - can listeners get passed across pages (i.e. avoiding a new query)

There are many cases where I need to listen to changes in the same document across multiple pages, but in order to do this it seems that I need to pass a reference or ID and perform a new query on each page. My understanding is that this spins up a new listener and causes a new read, each time.

Is there some behind-the-scenes magic that recognizes when I'm "passing a listener" or are there any tricks I can do to accomplish this?

Thanks very much in advance for any input.

4
13 replies