BlocListener?
antholeole opened this issue · 1 comments
antholeole commented
Is there a way to use this with bloc listener? currently, I'm literally just taking the state and doing:
BlocListener<MyCubit, MyState>(
listener: (context, state) {
state.join(
(_) {}, //empty here, as we don't do anything with this state
(wantedState) => print(wantedState.wantedProperty); //do something here
);
}
)
Is it possible to have a function on
on a state like:
state.on<WantedState>((wantedState) => print(wantedState.wantedProperty));
so that you can choose to only react to a single state as opposed to needing to put a voider function on every unwanted state?
felangel commented
This package is discontinued in favor of sealed class modifiers introduced in Dart 3.0.