状態管理に Riverpod を使用しています。
class SignInStateNotifier extends StateNotifier<SignInFormStates> {
SignInStateNotifier(this._authFacade) : super(SignInFormStates.initial());
final IAuthFacade _authFacade;
void mapEventToState(SignInFormEvents signInFormEvents) {
state = signInFormEvents.when(
emailChanged: (value) => state.copyWith(
emailAddress: EmailAddress(value),
authFailureOrSuccess: none(),
),
passwordChanged: (value) => state.copyWith(
password: Password(value),
authFailureOrSuccess: none(),
),
signInWithEmailAndPasswordPressed: () async* {
yield* _performActionOnAuthFacade(
_authFacade.signInWithEmailAndPassword);
});
}
ここでエラーが発生します
signInWithEmailAndPasswordPressed: () async* {
yield* _performActionOnAuthFacade(
_authFacade.signInWithEmailAndPassword);
});
引数の型 'Stream Function()' をパラメーターの型 'SignInFormStates Function()' に割り当てることはできません。
私の__performActionOnAuthFacade
機能
Stream<SignInFormStates> _performActionOnAuthFacade(
Future<Either<AuthFailure, Unit>> Function({
@required EmailAddress emailAddress,
@required Password password,
})
forwardCall,
) async* {
Either<AuthFailure, Unit> failureOrSuccess;
if (state.emailAddress.isValid() && state.password.isValid()) {
yield state.copyWith(
isSubmitting: true,
authFailureOrSuccess: none(),
);
failureOrSuccess = await _authFacade.registerWithEmailAndPassword(
emailAddress: state.emailAddress, password: state.password);
}
yield state.copyWith(
isSubmitting: false,
showErrorMessage: true,
authFailureOrSuccess: optionOf(failureOrSuccess));
}
このエラーを解決する解決策を教えてください。前もって感謝します。