Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for connect() #248

Open
wstrange opened this issue Apr 19, 2024 · 4 comments
Open

Documentation for connect() #248

wstrange opened this issue Apr 19, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@wstrange
Copy link

Not grokking how connect() works or why I would want to use it.

Some docs would be great!

@rodydavis rodydavis added the documentation Improvements or additions to documentation label Apr 19, 2024
@rodydavis
Copy link
Owner

Definitely want to add examples to the docs!

https://dartsignals.dev/async/connect/

The biggest reason to use it over StreamSignal is you work off of type T instead of AsyncState.

@wstrange
Copy link
Author

wstrange commented May 2, 2024

In the example in the docs, how do you actually "advance" or consume the signal value when a new value is emitted from a stream? A more concrete example would really help. Something that consumes the connected signal.

@rodydavis
Copy link
Owner

You mean outside of using an effect?

@wstrange
Copy link
Author

wstrange commented May 7, 2024

You mean outside of using an effect?

I'm honestly not sure I know the right question to ask.

If I have a Stream<Foo> I know I can create a stream signal from that. In my widget I'm going to get objects of AsyncState<Foo> - which is fine, I understand how to handle those (somewhat verbose, but it works).

Your previous comment implied I can 'connect' the stream to a non async signal, so my widget only deals with type Foo? And presumably only gets updated when the stream emits a new Foo into the "connected" signal?

A more complex example, ideally with a Flutter widget would really help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants