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

Improve on() stream when no type is specified #13

Closed
marcojakob opened this issue May 7, 2015 · 0 comments
Closed

Improve on() stream when no type is specified #13

marcojakob opened this issue May 7, 2015 · 0 comments

Comments

@marcojakob
Copy link
Owner

Use a null check and return the entire stream instead of always filtering the stream with where.

Stream on([Type eventType]) {
  if (eventType == null) {
    return streamController.stream;
  } else {
    return streamController.stream.where((event) => event.runtimeType == eventType);
  }
}

Note: Applies to EventBus and HierarchicalEventBus.

@marcojakob marcojakob changed the title Improve on() stream wehn no type is specified Improve on() stream when no type is specified May 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant