class CounterBloc extends Bloc<CounterEvent, CounterState> {
CounterBloc() : super(CounterState()) {
on<CounterIncrementEvent>((event, emit) {
emit(state.copyWith(count: state.count++));
// if i use state.count+1 its working.
});
on<CounterDecrementEvent>((event, emit) {
emit(state.copyWith(count: state.count--));
// if i use state.count-1 its working.
});
}
}
当使用 __ 或 ++ 时它不起作用而当我改变 state.count+1 或 state.count-1 时它起作用了查找..那么问题是什么..