-
Notifications
You must be signed in to change notification settings - Fork 50
Updates for Dart 2.0 core library changes (wave 2.2) #45
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,14 +53,18 @@ class TypeSafeStream<T> extends Stream<T> { | |
Stream<S> expand<S>(Iterable<S> convert(T value)) => | ||
_stream.expand(_validateType(convert)); | ||
|
||
Future firstWhere(bool test(T element), {Object defaultValue()}) => | ||
_stream.firstWhere(_validateType(test), defaultValue: defaultValue); | ||
|
||
Future lastWhere(bool test(T element), {Object defaultValue()}) => | ||
_stream.lastWhere(_validateType(test), defaultValue: defaultValue); | ||
|
||
Future<T> singleWhere(bool test(T element)) async => | ||
(await _stream.singleWhere(_validateType(test))) as T; | ||
Future<T> firstWhere(bool test(T element), | ||
{Object defaultValue(), T orElse()}) => | ||
_stream.firstWhere(_validateType(test), | ||
defaultValue: defaultValue ?? orElse); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I want to (need to?) land this before @lrhn lands the breaking change in the SDK, so currently there is no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding from talking with @srawlins at Dart Conf was that we were just going to have this package briefly be in a broken state on master. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see. Yes, I'm fine with that solution if you prefer. It does reduce the number of PRs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @keertip @srawlins If I make all of the changes in one go here and leave it on a branch, does that work for testing internal code? I think that means you would have to test with an atomic CL, since you couldn't roll this package before you roll the SDK. You would then presumably also have to roll this package with the SDK when we finally land. Does that work, or should we do these changes in two passes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that works with testing internal code. It... should work for SDK as well, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thinking about it, I guess I could push multiple commits to this branch, and then we could roll internal to the first tagged commit (this version), then roll internal to the second tagged commit (the final version). As far as this package is concerned, there is just one PR with a bunch of commits, but internally we can point to different hashes in this branch at different points in the process. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need multiple commits? Can't both the SDK and internal atomically add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We want internal to be green before we land the changes in the SDK. To get internal green, we need to run presubmits, fix, iterate. It makes running presubmits easier if we can roll a dev.20 compatible version internally. So I think having two commits to reference here for now would be better. Since we're referencing them off the branch, I don't think it should matter in the long run - we'll just leave this branch sitting here for now, and land the PR atomically as usual once everything is ready. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
|
||
Future<T> lastWhere(bool test(T element), | ||
{Object defaultValue(), T orElse()}) => | ||
_stream.lastWhere(_validateType(test), | ||
defaultValue: defaultValue ?? orElse); | ||
|
||
Future<T> singleWhere(bool test(T element), {T orElse()}) async => | ||
(await _stream.singleWhere(_validateType(test))) ?? orElse(); | ||
|
||
Future<S> fold<S>(S initialValue, S combine(S previous, T element)) => | ||
_stream.fold( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I'd write this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.