Hello
Why do you use currentState in mapEventToState if currentState is a property of bloc and can be access with the same way without be a parameter of mapEventToState
Thanks.
@override
Stream<int> mapEventToState(int currentState, CounterEvent event) async* {
yield currentState +1;
}
the same as this
@override
Stream<int> mapEventToState( CounterEvent event) async* {
yield currentState +1;
}
@GiancarloCode thanks for bringing this up! Originally, blocs didn't have a currentState property so the mapEventToState method needed it. Now that currentState is a property in all Blocs it is no longer needed.
Thanks again for bringing this up! I totally forgot to make this simplification after adding currentState property.
published in bloc v0.11.0 馃帀
Most helpful comment
@GiancarloCode thanks for bringing this up! Originally, blocs didn't have a
currentStateproperty so themapEventToStatemethod needed it. Now thatcurrentStateis a property in all Blocs it is no longer needed.162 will address this and it will be included in the next release (v0.11.0).
Thanks again for bringing this up! I totally forgot to make this simplification after adding
currentStateproperty.