why am i getting the error? I couldn't find the reason. I'll be happy if you can help me.
您可以对 StatefulWidget 状态使用相同的名称,并在块或状态中再次使用该名称请不要重复相同的名称,这就是错误来的原因
this happens when
ex:
class CounterBloc extends Bloc<CounterBloc, CounterState> {
CounterBloc() : super(const InitialState()) {
on<IncrementEvent>((event, emit) {
emit(IncrementedCounterState());
});
on<IncrementEvent>((event, emit) {
emit(DecrementedCounterState());
});
}
}
I should pass the Event not the bloc in the Bloc<CounterBloc,CounterState>
and it should be Bloc<CounterEvent,CounterState>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.