jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.33k stars 1.62k forks source link

Checking Firestore connection state with Getx() #2170

Open jaymanned opened 2 years ago

jaymanned commented 2 years ago

Hi

I'm new to Getx and Flutter. I really like what I've seen so far. Getx's drive to make flutter development easier for all in contrast with Google's unavoidable trend to overcomplicate some otherwise fantastic development ideas.

But getting to the point. I'd like to use Getx() to build a list of posts from Firestore. However, the app needs to be able to detect the typical events/states related with data feeds: errors, loading, no data and data available.

Reading through the different support platforms, I've found ways to detect errors with stream.listen() or try ... catch blocks. However, I haven't found yet a way to detect loading and no data conditions. At the end, devs facing similar needs have ended up using Stream builders (like here).

So, this is potentially a feature request to add some sort of stream connection state monitoring capabilities to Getx().

(If these features are already there, please excuse me. I tried hard but couldn't find them...)

Shreemanarjun commented 2 years ago

Use StateMixin. https://github.com/jonataslaw/getx#statemixin

jaymanned commented 2 years ago

Hi @Shreemanarjun

Didn't know this one. Looks like a very useful feature. But my problem is more detecting these events in the Firestore stream, not so much flagging them (I can use observable booleans in my controller for that).