我是新来的集团。我的错误是“名称'_SignInFormState'不是类型,不能在重定向的构造函数中使用。尝试重定向到不同的构造函数。颤振。”我生成了冷冻文件。问题仍然存在。
part of 'sign_in_form_bloc.dart';
@freezed
abstract class SignInFormState with _$SignInFormState {
const factory SignInFormState({
@required String emailAddress,
@required String password,
@required bool showErrorMessages,
@required bool isSubmitting,
// @required AuthFailureOrSuccess authFailureOrSuccess,
}) = _SignInFormState;
factory SignInFormState.initial() => SignInFormState(
emailAddress: '',
password: '',
showErrorMessages: false,
isSubmitting: false,
// authFailureOrSuccess: AuthFailureOrSuccess.none(),
);
}
我生成了冷冻文件。问题仍然存在。这些是来自 sign_in_form_bloc.dart 的代码
@injectable
class SignInFormBloc extends Bloc<SignInFormEvent, SignInFormState> {
final IAuthFacade _authFacade;
SignInFormBloc(this._authFacade) : super(SignInFormState.inital());
@override
Stream<SignInFormState> mapEventToState(SignInFormEvent event) async* {
yield* event.map(
emailChange: (event) async* {
yield state.copyWith(
emailAddress: event.email,
authFailureOrSuccess: AuthFailureOrSuccess.none(),
);
},
passwordChange: (event) async* {
yield state.copyWith(
password: event.password,
authFailureOrSuccess: AuthFailureOrSuccess.none(),
);
},
signInWithEmailAndPassword: (event) async* {
final String? email = state.emailAddress;
final String? password = state.password;
if (validateEmailAddress(email!) && validatePassword(password!)) {
yield state.copyWith(
showErrorMessages: false,
isSubmitting: true,
authFailureOrSuccess: AuthFailureOrSuccess.none(),
);
var result = await _authFacade.signInWithEmailAndPassword(
emailAddress: email,
password: password,
);
yield state.copyWith(
isSubmitting: false,
authFailureOrSuccess: result!.authFailureOrSuccess,
);
} else {
yield state.copyWith(
showErrorMessages: true,
authFailureOrSuccess: AuthFailureOrSuccess.none());
}
},
);
}
}