dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.2k stars 1.57k forks source link

Problem with streams and recursion #38988

Closed ihsancemil closed 4 years ago

ihsancemil commented 5 years ago

I'm building flutter app. I'm using bloc pattern as design architecture. Bloc patterns uses Streams to share data between business logic to the ui components.

I want to build a simple sorting algorithm visualizer app*. Sorting algorithms generally uses recursion. For each list change I should notify the ui with yielding the current list.

I'm using yield for ui update and yield when I need to recursively call the method. I'm not sure but as far as I saw, after the first yield all yield's return their values.

I searched this however I think nobody tried yield* for recursive approach. Can you guys brighten me?

srawlins commented 5 years ago

Thanks for your interest in Dart, @ihsancemil. Unfortunately, we cannot help with individual Flutter app questions. Can you give an example of using yield and yield* in a basic asynchronous setting, and explain what you want to happen, and what is actually happening? DartPad is a great playground for trying out ideas in vanilla Dart.

no-response[bot] commented 4 years ago

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away! Thanks for your contribution.