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

throttled stream ignores the close command #709

Open
aurokk opened this issue Jan 13, 2023 · 0 comments
Open

throttled stream ignores the close command #709

aurokk opened this issue Jan 13, 2023 · 0 comments
Assignees
Labels
bug Something isn't working under evaluation We are determining the bast way to approach this issue

Comments

@aurokk
Copy link

aurokk commented Jan 13, 2023

Hey!
I was playing around with rxdart and faced a problem.
When throttleTime is used then the stream ignores the close command.
Is that by design or I'm doing sth wrong?

I use the latest versions of rxdart (0.27.7)/flutter (3.3.10) :-)

// WORKS

main() async {
  final c = StreamController<String>();
  Future.delayed(Duration(seconds: 5)).then((f) => c.close());
  final s = c.stream;
  print("start");
  await for (var _ in s) {
    print("loop");
  }
  print("end");
}

// WORKS

main() async {
  final c = StreamController<String>();
  Future.delayed(Duration(seconds: 5)).then((f) => c.close());
  final s = c.stream.debounceTime(Duration(seconds: 1));
  print("start");
  await for (var _ in s) {
    print("loop");
  }
  print("end");
}

// DOESN'T WORK, NEVER REACHES THE END

main() async {
  final c = StreamController<String>();
  Future.delayed(Duration(seconds: 5)).then((f) => c.close());
  final s = c.stream.throttleTime(Duration(seconds: 1));
  print("start");
  await for (var _ in s) {
    print("loop");
  }
  print("end");
}
@aurokk aurokk changed the title throttle ignores stream close throttletime ignores stream close Jan 13, 2023
@aurokk aurokk changed the title throttletime ignores stream close throttled stream ignores the close command Jan 13, 2023
@hoc081098 hoc081098 self-assigned this Jan 17, 2023
@hoc081098 hoc081098 added bug Something isn't working under evaluation We are determining the bast way to approach this issue labels Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working under evaluation We are determining the bast way to approach this issue
Projects
None yet
Development

No branches or pull requests

2 participants