I have a bloc that stores a list of objects for the feed (pageview). When one of the properties of an object in the list changes using emit, the bloc does not cause changes in the UI until you start flipping through the tape.
BlocBuilder
BlocBuilder<PatientsBloc, PatientsState>(
builder: (context, state) {
return Expanded(
child: CustomSwiper(
fade: 0.5,
loop: false,
itemCount: state.patients.length,
viewportFraction: 0.85,
scale: 0.9,
itemBuilder: (context, index) {
return PatientCard(
patient: state.patients[index],
);
}),
);
},
),
event where I call emit
_onUpdatePatientFromSocket(
UpdatePatientFromSocket event, Emitter<PatientsState> emit){
var patients = state.patients;
int newValue = event.data['payload']['sum_fundraised'];
patients[event.data['keys']] = patients[event.data['keys']].copyWith(currentAmount: newValue);
emit(PatientsState(patients: patients, status: state.status));
}