-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Refactor Bloc to extend Stream<State> #572
Conversation
@brianegan can you take a look? I'm planning to open a separate PR to implement |
Codecov Report
@@ Coverage Diff @@
## master dart-lang/linter#572 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 11 11
Lines 184 186 +2
=====================================
+ Hits 184 186 +2
Continue to review full report at Codecov.
|
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.
Some of the broadcast stream bits can be removed! Other than that, I think it's quite nice -- especially accessing state
inside the mapEventToState
methods :)
Thanks for the feedback @brianegan. Can you please re-review? 😄 |
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.
From a code perspective, looks good to me!
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.
Big fan of the new API! Thank @brianegan for the feedback, and all your help! 💯
Ouch, could you please notify of breaking changes before pushing big stuff like this? Thanks |
Maybe introduce a temporary |
@larssn well, it had a major version pump, so you shouldn't have gotten this via the usual pub get |
@bigworld12 @tenhobi You're right, but semver is only respected by some package authors, and not others. I haven't seen mention that this package was not fit for production, or in alpha, for that matter. In fact, there's a forum thread entitled "Are you using bloc in production". I know the BMW guys are using it in production, because they're stating so in that thread. The API has changed a few times now. This time was a bit harder to swallow that the last one, as this conflicts with the lint rule Example: I hope I'm not coming off as angry, because that's not the case. I still consider the package essential for complex state management. 👍🏻 |
@larssn In the link you provided, there is mentioned this: 😃
If the package was updated from 0.15.x to 0.16.x (dunno if it was, that's what I see in your post) then it is concidered as a major change by Dart. Check caret syntax, it should work with |
Lol, well, that certainly sounds different from standard semver then. 😅 Can't believe I missed that! So Dart is something like |
@larssn sorry for any inconvenience but as everyone else stated you should not have automatically gotten the update unless you are always using latest and for 0.x.x versions the minor version is treated like the major version. Also it was impossible to avoid a breaking change because the state variable went from being a Stream to a value so I thought it made more sense to make state/currentState a breaking change to make it clear that people had to do some renaming whereas dispose/dispatch are deprecated so you have until 1.0.0 to refactor those. Hope that helps 👍 |
@felangel Thanks, I've sorted out our pubspec! 🙂 Any idea how we deal with the lint issue I mentioned above? |
@felangel @larssn I think that's actually a bug with the linter package, although it might be a difficult one to fix. I'd recommend folks contribute examples to this issue: dart-lang/sdk#57882 |
Status
READY
Breaking Changes
YES
Description
Refactor
Bloc
to extendStream<State>
bloc.state.listen(print);
becomes
bloc.listen(print);
Rename
currentState
tostate
becomes
Todos
Impact to Remaining Code Base
flutter_bloc
andangular_bloc