Closed yarenalbayr closed 1 month ago
Hi @yarenalbayr 👋 Thanks for opening an issue!
Are you able to provide a link to a minimal reproduction sample? It'd be much easier to help if I'm able to run your sample and reproduce/debug the issue locally.
Closing for now since there's no link to a minimal reproduction sample. If this is still an issue please share a link to a minimal reproduction sample and I'm more than happy to take a closer look, thanks!
Issue: State Reversion after Navigation in Flutter Bloc
Description
I have a Flutter app where the
UserEditProfileBloc
is used in the "Edit Profile Details" screen. The bloc is created using aFutureBuilder
that fetches the user's profile details. When navigating to a separate screen usingBlocConsumer
's listener and passing the bloc instance through theNavigator
to edit certain details, the state is updated correctly. However, after popping back to the "Edit Profile Details" screen and navigating again, the previous state is passed.Reproduction Steps
Initial Setup:
UserEditProfileBloc
is initialized usingBlocProvider
within aFutureBuilder
.Navigating to the Editing Screen:
BlocConsumer
's listener is used to handle navigation events.Editing and Returning:
Navigating Again:
Bloc Setup
The
UserEditProfileBloc
handles two types of events:Code
The issue might relate to how the bloc state is handled across navigation. Below are snippets of the bloc, the screen setup, and navigation:
1. Bloc Setup
Using freezed package for bloc's events
My bloc
Edit Profile Details View
My interest is showing a chip of widget in edit profile and it will call the navigation event on tap
The event that is in my
The SelectInterests page shows the selected interests of that user and allows user to select more or less and on pop it calls