Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flutter bloc emit.onEach fail #67

Open
miguelangelflores1993 opened this issue May 25, 2023 · 3 comments
Open

flutter bloc emit.onEach fail #67

miguelangelflores1993 opened this issue May 25, 2023 · 3 comments

Comments

@miguelangelflores1993
Copy link

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.

@miguelangelflores1993
Copy link
Author

@tanutapi help please

@tanutapi
Copy link
Owner

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.

@miguelangelflores1993
Copy link
Author

miguelangelflores1993 commented Jun 9, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants