rrousselGit / flutter_hooks

React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a complete replacement for StatefulWidget.
MIT License
3.07k stars 175 forks source link

Add useStreamListener hook #372

Closed jezsung closed 10 months ago

jezsung commented 11 months ago

Adds a new hook useStreamListener that allows you to subscribe to a Stream and register callback handlers such as onData, onError, and onDone.

codecov[bot] commented 11 months ago

Codecov Report

Patch coverage: 96.77% and project coverage change: -0.12 :warning:

Comparison is base (4f70845) 99.87% compared to head (495bea0) 99.75%.

:exclamation: Current head 495bea0 differs from pull request most recent head b598579. Consider uploading reports for the commit b598579 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #372 +/- ## ========================================== - Coverage 99.87% 99.75% -0.12% ========================================== Files 18 18 Lines 775 806 +31 ========================================== + Hits 774 804 +30 - Misses 1 2 +1 ``` | [Impacted Files](https://app.codecov.io/gh/rrousselGit/flutter_hooks/pull/372?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Remi+Rousselet) | Coverage Δ | | |---|---|---| | [packages/flutter\_hooks/lib/src/async.dart](https://app.codecov.io/gh/rrousselGit/flutter_hooks/pull/372?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Remi+Rousselet#diff-cGFja2FnZXMvZmx1dHRlcl9ob29rcy9saWIvc3JjL2FzeW5jLmRhcnQ=) | `99.32% <96.77%> (-0.68%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

jezsung commented 11 months ago

Please take a look at the https://github.com/rrousselGit/flutter_hooks/pull/373 first. I added a new hook useStreamSubscription which does the same thing but more flexible than the useStreamListener hook. I think this PR could be closed if the other one is merged.

rrousselGit commented 10 months ago

Closing this since the other PR was merged :)