Skip to content

Instantly share code, notes, and snippets.

@okorokhina
Created September 11, 2020 11:57
class VerificationBloc extends Bloc<VerificationEvent, VerificationState> {
VerificationInfo verification;
IVerificationService verificationService = VerificationService();
@override
VerificationState get initialState => VerificationInitial();
@override
Stream<VerificationState> mapEventToState(
VerificationEvent event,
) async* {
if(event is FeatchVerificationDataEvent){
if(verification == null){
verification = await verificationService.fetchVerificationData(verificationsUrl);
yield VerificationDataResponseState(verificationData: verification);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment