flutter bloc emit.onEach fail
I am using the meteor liberia with flutter_bloc
i have this function
on<InitialPlansEvent>(
(event, emit) async {
emit(state.copyWith(loading: true));
await emit.onEach(streamController, onData: (data) {
var refactorMap = data.map((key, value) => MapEntry(key, value)).values.toList();
List<PlansModel> plansList = refactorMap.map<PlansModel>((e) => PlansModel.fromJson(e)).toList();
print(data);
add(SuccessPlansEvent(data: plansList));
});
emit(state.copyWith(loading: false));
},
transformer: restartable(),
);
I want it to be broadcast emit(state.copyWith(loading: false));
but it's like it never finished emitting the emit.onEach function.
@tanutapi help please
Sorry, I have no idea about integrating with flutter_bloc. When using meteor as a backend, I mostly keep all states on the server side.
@tanutapi but this is common, imagine if I use a stream of integers, this would work. but with the Strem of meteor, he stays thinking forever. Maybe it would be good to try Flutter_bloc, since it is a widely used state manager.
but this is common, imagine if I use a stream of integers, this would work. but with the Strem of meteor, he stays thinking forever. Maybe it would be good to try Flutter_bloc, since it is a widely used state manager.
They should look for a solution, if it doesn't cause too much trouble. I love this library, it's an excellent job.