SurveyPresenter constructor
SurveyPresenter({
- required dynamic onResult(),
Implementation
SurveyPresenter({
required this.taskNavigator,
required this.onResult,
}) : super(LoadingSurveyState()) {
on<StartSurvey>((event, emit){
emit(
_handleInitialStep()
);
});
on<NextStep>((event, emit){
if (state is PresentingSurveyState){
emit(_handleNextStep(event, state as PresentingSurveyState));
}
});
on<StepBack>((event, emit){
if (state is PresentingSurveyState){
emit(
_handleStepBack(event, state as PresentingSurveyState)
);
}
});
on<CloseSurvey>((event, emit){
if (state is PresentingSurveyState){
emit(
_handleClose(event, state as PresentingSurveyState)
);
}
});
this.startDate = DateTime.now();
add(StartSurvey());
}