Created
February 29, 2020 19:28
-
-
Save tomalabaster/cf80588cde9a2f23375a4d4e9eb26b3e 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
import 'package:flutter_app_template/blocs/base_bloc.dart'; | |
import 'package:flutter_app_template/blocs/state_yielding_example_blocs/full_state_yielding_screen_bloc/full_state_yielding_screen_event.dart'; | |
import 'package:flutter_app_template/blocs/state_yielding_example_blocs/full_state_yielding_screen_bloc/full_state_yielding_screen_state.dart'; | |
class FullStateYieldingScreenBloc extends BaseBloc<FullStateYieldingScreenEvent, | |
FullStateYieldingScreenState> { | |
int _property1; | |
int _property2; | |
int _property3; | |
@override | |
FullStateYieldingScreenState get initialState { | |
this._property1 = 0; | |
this._property2 = 0; | |
this._property3 = 0; | |
return this.fullState; | |
} | |
@override | |
Stream<FullStateYieldingScreenState> mapEventToState( | |
FullStateYieldingScreenEvent event) async* { | |
if (event is FullStateYieldingScreenEventIncrementProperty1) { | |
this._property1++; | |
yield this.fullState; | |
} | |
if (event is FullStateYieldingScreenEventIncrementProperty2) { | |
this._property2++; | |
yield this.fullState; | |
} | |
if (event is FullStateYieldingScreenEventIncrementProperty3) { | |
this._property3++; | |
yield this.fullState; | |
} | |
} | |
@override | |
FullStateYieldingScreenState get fullState => FullStateYieldingScreenState( | |
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