kranfix / riverbloc

`flutter_bloc` implemented with `riverpod` instead of `provider`.
83 stars 17 forks source link

Best practice for changing from listener state to builder state #49

Closed ninoid closed 3 years ago

ninoid commented 3 years ago

I am working with bloc for one year and acheived some bloc skills, but also a lot of benefits using bloc. I am wondering what is right way when changing from listener state to builder state without rebuilding stuff. Example: I have 2 states. BuildUIState and ShowSnackbarWithMessageState. Page is build with BuildMyUIState but I am listening with listenWhen for ShowSnackbarWithMessageState and showing snackbar to user. After showing Snakcbar with ShowSnackbarWithMessageState, on later event I need to access to BuildMyUIState but current state is ShowSnackbarWithMessageState and can not use previous BuildMyUIState data to continue with. I know that I can yield BuildMyUIState right after ShowSnackbarWithMessageState but that is overhead and page is rebild without real reason. My question is how I can get access to latest BuildMyUIState when block current state is ShowSnackbarWithMessageState. What is best practice for this kind scenario? I hope that my quiestion is well formed and clear :)

ninoid commented 3 years ago

Wrong repo :) Sorry.