im new to bloc pattern in flutter.
One of my states classes have a list of widget and an index as a field. My goal is to update the child of an Animated Switcher using this state's widgets.
return AnimatedSwitcher(
duration: Duration(milliseconds: 500),
child: BlocBuilder<WelcomeBloc, WelcomeBlocState>(
builder: (context, state) {
if(state is MyState)
return state.widgetList[state.index];
else return Container();
},
),
);
I have also tried the other way around, returning the animated switcher in the bloc builder and the result is the same
When yield is called, the widget is changed but without any animation.
What am I missing?