Last active
February 29, 2020 19:28
-
-
Save tomalabaster/6f7280b16d7de208d5e9e14092981bce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PartialStateYieldingScreenBloc extends BaseBloc< | |
PartialStateYieldingScreenEvent, PartialStateYieldingScreenState> { | |
int _property1; | |
int _property2; | |
int _property3; | |
@override | |
PartialStateYieldingScreenState get initialState { | |
this._property1 = 0; | |
this._property2 = 0; | |
this._property3 = 0; | |
return this.fullState; | |
} | |
@override | |
Stream<PartialStateYieldingScreenState> mapEventToState( | |
PartialStateYieldingScreenEvent event) async* { | |
if (event is PartialStateYieldingScreenEventIncrementProperty1) { | |
this._property1++; | |
yield PartialStateYieldingScreenState(property1: this._property1); | |
} | |
if (event is PartialStateYieldingScreenEventIncrementProperty2) { | |
this._property2++; | |
yield PartialStateYieldingScreenState(property2: this._property2); | |
} | |
if (event is PartialStateYieldingScreenEventIncrementProperty3) { | |
this._property3++; | |
yield PartialStateYieldingScreenState(property3: this._property3); | |
} | |
} | |
@override | |
PartialStateYieldingScreenState get fullState => | |
PartialStateYieldingScreenState( | |
property1: this._property1, | |
property2: this._property2, | |
property3: this._property3); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment