You shouldn't override initialState
. If you'd like to specify the initial state in your Bloc
class while having a zero-argument constructor, constructor, then do something like this:
CounterBloc() : super(ShowCounterState(0));
Alternatively, use the constructor in your point #1, and pass the value when instantiating the Bloc, like so:
final yourBloc = CounterBloc(ShowCounterState(0));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…