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

Bloc Internal Mapping to Transition #840

Merged
merged 6 commits into from Feb 10, 2020
Merged

Conversation

felangel
Copy link
Owner

@felangel felangel commented Feb 2, 2020

Status

READY

Breaking Changes

YES

Description

  • Refactor to bloc to map directly to Transition objects which encapsulate the current transition in order to ensure that transitions occur for the respective event/state pair -- addresses Remove RxDart dependency #839 (comment).
  • Rename transformStates to transformTransitions
  • transformEvents signature change to take a TransitionFunction

Todos

  • Tests
  • Documentation
  • Examples

Impact to Remaining Code Base

  • Breaking changes
    • transformStates -> transformTransitions
    • Function signature changes to transformEvents

@felangel felangel added enhancement candidate Candidate for enhancement but additional research is needed feedback wanted Looking for feedback from the community pkg:bloc This issue is related to the bloc package labels Feb 2, 2020
@felangel felangel self-assigned this Feb 2, 2020
@felangel felangel added this to In progress in bloc via automation Feb 2, 2020
@felangel felangel changed the title Decouple Bloc from RxDart Bloc Internal Mapping to Transition Feb 2, 2020
@codecov
Copy link

codecov bot commented Feb 3, 2020

Codecov Report

Merging #840 into master will not change coverage by %.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #840   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           23        20    -3     
  Lines          373       351   -22     
=========================================
- Hits           373       351   -22     
Impacted Files Coverage Δ
...login/lib/authentication/authentication_event.dart
...login/lib/authentication/authentication_state.dart
..._login/lib/authentication/authentication_bloc.dart

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 34cd11e...8c52bf5. Read the comment docs.

@felangel felangel force-pushed the bloc/transition-function branch 2 times, most recently from 61c7a01 to d2856d0 Compare February 3, 2020 01:47
@felangel
Copy link
Owner Author

felangel commented Feb 3, 2020

@brianegan when you have a min can you please take a look and lmk what you think? Thanks!

jorgecoca
jorgecoca previously approved these changes Feb 3, 2020
Copy link
Collaborator

@jorgecoca jorgecoca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

one thing I would suggest doing after this gets merged is to spend more time in the docs explaining what is a Transition, since I feel like we always talk about a few basic concepts, such as events/states, but always ignore transitions

brianegan
brianegan previously approved these changes Feb 8, 2020
Copy link

@brianegan brianegan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Only thing I'd consider: Adding a test to ensure each transition delivers the correct event with it. A test like that should fail in certain cases with the previous implementation (such as using flatMap instead of asyncExpand in the transformEvents function), but should work with this new implementation.

packages/bloc/lib/src/bloc.dart Outdated Show resolved Hide resolved
packages/bloc/lib/src/bloc.dart Outdated Show resolved Hide resolved
@felangel felangel dismissed stale reviews from brianegan and jorgecoca via 7b203d0 February 9, 2020 01:58
@felangel felangel force-pushed the bloc/transition-function branch 2 times, most recently from d5bbbb0 to bff6ffc Compare February 9, 2020 02:02
@felangel felangel merged commit aaed93e into master Feb 10, 2020
bloc automation moved this from In progress to Done Feb 10, 2020
@felangel felangel deleted the bloc/transition-function branch February 10, 2020 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement candidate Candidate for enhancement but additional research is needed feedback wanted Looking for feedback from the community pkg:bloc This issue is related to the bloc package
Projects
bloc
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants