'Flutter Code do not enter method called with Bloc > 7.2
I tried copying the Code provided by ResoCoder (which is about 2years old from now). GitHub Project Therefore I had to migrate everything to the current BLOC Version 8.0.3. However I got stuck in the following:
SignInFormBloc(this._authFacade) : super(SignInFormState.initial()) {
on<RegisterWithEmailAndPasswordPressed>((event, emit) {
print("Register");
_performActionOnAuthFacadeWithEmailAndPassword(
_authFacade.registerWithEmailAndPassword,
);
});
}
//Here is the called method
Stream<SignInFormState> _performActionOnAuthFacadeWithEmailAndPassword(
Future<Either<AuthFailure, Unit>> Function({
required EmailAddress emailAddress,
required Password password,
})
forwardedCall,
) async* {
print("first line");
Either<AuthFailure, Unit> failureOrSuccess =
const Right<AuthFailure, Unit>(unit);
final isEmailValid = state.emailAddress.isValid();
final isPasswordValid = state.password.isValid();
if (isEmailValid && isPasswordValid) {
print("if valid");
yield state.copyWith(
isSubmitting: true,
authFailureOrSuccessOption: none(),
);
failureOrSuccess = await forwardedCall(
emailAddress: state.emailAddress,
password: state.password,
);
}
yield state.copyWith(
isSubmitting: false,
showErrorMessages: true,
authFailureOrSuccessOption: optionOf(failureOrSuccess),
);
}
The Code enter the call of on event, however the first Print-statement of the calles method is not triggered. Do someone have a hint why this could happen?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
