fix!(form): fix states with required form
This commit is contained in:
parent
f031b3cbf5
commit
ae3711a136
@ -16,24 +16,21 @@
|
||||
|
||||
part of 'form_data_cubit.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
abstract class FormDataState extends Equatable {
|
||||
/// Global status of a form.
|
||||
final FormStatus status;
|
||||
|
||||
/// FormData with all inputs, and associated metadata.
|
||||
late WyattForm form;
|
||||
final WyattForm form;
|
||||
|
||||
/// Optional error message.
|
||||
final String? errorMessage;
|
||||
|
||||
FormDataState({
|
||||
WyattForm? form,
|
||||
const FormDataState({
|
||||
required this.form,
|
||||
this.status = FormStatus.pure,
|
||||
this.errorMessage,
|
||||
}) {
|
||||
this.form = form ?? WyattFormImpl(const [], name: '');
|
||||
}
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [status, form, errorMessage];
|
||||
|
@ -16,9 +16,8 @@
|
||||
|
||||
part of 'form_data_cubit_impl.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class FormDataStateImpl extends FormDataState {
|
||||
FormDataStateImpl({
|
||||
const FormDataStateImpl({
|
||||
required super.form,
|
||||
super.status = FormStatus.pure,
|
||||
super.errorMessage,
|
||||
@ -39,6 +38,6 @@ class FormDataStateImpl extends FormDataState {
|
||||
List<Object?> get props => [status, form, errorMessage];
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'FormDataSate(status: ${status.name} ${(errorMessage != null) ? " [$errorMessage]" : ""}, $form';
|
||||
String toString() => 'FormDataSate(status: ${status.name} '
|
||||
'${(errorMessage != null) ? " [$errorMessage]" : ""}, $form)';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user