Bloc: The member 'emit' can only be used within 'package:bloc/src/bloc.dart' or a test

Created on 20 Aug 2020  路  1Comment  路  Source: felangel/bloc

Describe the bug
If I use the emit function while using bloc, a warning occurs.

Expected behavior
In my opinion, bloc inherits cubit, emit should be used.
Am I using it incorrectly? I wonder if you don't want to use emit in bloc.

Screenshots
If applicable, add screenshots to help explain your problem.
image
image

question

Most helpful comment

Hi @ybin0823 馃憢
Thanks for opening an issue!

This is working as expected. emit should only ever be used within a Cubit. If you are extending Bloc you must override mapEventToState to yield new states.

Hope that helps 馃憤

>All comments

Hi @ybin0823 馃憢
Thanks for opening an issue!

This is working as expected. emit should only ever be used within a Cubit. If you are extending Bloc you must override mapEventToState to yield new states.

Hope that helps 馃憤

Was this page helpful?
0 / 5 - 0 ratings