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

Streams #310

Closed tadaspetra closed 4 years ago

tadaspetra commented 4 years ago

Hello, I recently created a video about your package.

State and Navigation Management with GetX

I was wondering if you could critique it to let me know if I am understanding it right.

I also received a question. Do we need to close the stream in the state? Doesn’t StreamBuilder take care of disposing streams?

Great work! Thanks!

Nipodemos commented 4 years ago

Hey, Thank you for making this video! it helps so much for people to start using it, and you showed the best part of get, the route management, that's the seller of this package heheh

Hope you try a little more the state management part! it is very good, and i loved it!

jonataslaw commented 4 years ago

Hello, I recently created a video about your package.

State and Navigation Management with GetX

I was wondering if you could critique it to let me know if I am understanding it right.

I also received a question. Do we need to close the stream in the state? Doesn’t StreamBuilder take care of disposing streams?

Great work! Thanks!

Hi @tadaspetra, Initially, congratulations on the content. I just saw your video and left a comment there. I just made a point in the Streams section.

Since GetX is entirely based on Streams, you can merge variables, add other Streams to a variable, transform Streams into a variable and do anything else that reactive programming allows you to do. In your example you created a StreamBuilder, and this is not necessary with Get. You could have eliminated many lines of code in this example.

Let's say the firebase is a given by a Stream, either from the firestore, or something else. You want to receive the amount and change it on the screen. Say you get a number from him, as you did in the example, you can just do this:

RxInt number = 0.obs;
number.bindStream(doc);

When the data arrives from Firebase, it will automatically enter a sink in GetX, and it will check the widget using number.value, and change it automatically. You could eliminate this StreamBuilder and this StreamController from your code. This is one of the points that GetX makes life easier, you can have dozens of data sources, and you will not need a StreamBuilder for each one, much less a StreamController. If a string, number, list or anything from the server arrives, you don't need to nest dozens of StreamBuilders to change multiple data. Simply place everything inside an Obx() and GetX will do everything for you automatically , without you worrying about anything.

Remembering that since Controllers have lifecycles, you can sign this change in onInit() Then take a look at the Workers too, they are amazing.

tadaspetra commented 4 years ago

@jonataslaw Awesome, thank you for the feedback. The first video was more to introduce people to the package, people seemed to really enjoy it, and want some more.

I'll make sure to look into all your points, and then do some more digging from your documentation, but in case I run into a roadblock is there a better way I can contact you other than creating an issue on GitHub?

jonataslaw commented 4 years ago

I'm not sure which media you use most (Facebook, Telegram, Twitter, Discord, Slack), but I just saw a post from you in a Facebook group and added you there. I will create GetX's communication channels too, but you can contact me more directly over there, either by email (jonataborges01@gmail.com), or by any other means you prefer. You can text me if you have any questions about the lib, or about using it.

Nipodemos commented 4 years ago

@tadaspetra can i put a link to your video in documentation?

tadaspetra commented 4 years ago

@tadaspetra can i put a link to your video in documentation?

Of course! I’m planning to create some more videos on GetX as well 😊

jonataslaw commented 4 years ago

@Nipodemos Do you also have any direct contact? You are one of lib's collaborators and we only talk for issues hahaha

giiyms commented 4 years ago

Is there a slack/discord for GetX discussions? I like the package, reduces so much boilerplate but seems there is a lot of hidden functionality.

Nipodemos commented 4 years ago

@jonataslaw i have Discord, @ alanduarte#6930 My email is nipodemos13@gmail.com

jonataslaw commented 4 years ago

Well, I think I can close this here

rawquesh commented 3 years ago

checkout this method for the stream with firebase, link