fix: make cubit custom implementation simpler
This commit is contained in:
parent
68a582c3ad
commit
f031b3cbf5
@ -21,6 +21,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:wyatt_form_bloc/src/core/enums/form_status.dart';
|
||||
import 'package:wyatt_form_bloc/src/core/enums/set_operations.dart';
|
||||
import 'package:wyatt_form_bloc/src/core/enums/validation_error.dart';
|
||||
import 'package:wyatt_form_bloc/src/data/form/wyatt_form_impl.dart';
|
||||
import 'package:wyatt_form_bloc/src/domain/form/wyatt_form.dart';
|
||||
import 'package:wyatt_form_bloc/src/domain/input_validators/form_input_validator.dart';
|
||||
|
||||
|
@ -16,19 +16,25 @@
|
||||
|
||||
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.
|
||||
final WyattForm form;
|
||||
late WyattForm form;
|
||||
|
||||
/// Optional error message.
|
||||
final String? errorMessage;
|
||||
|
||||
const FormDataState({
|
||||
required this.form,
|
||||
FormDataState({
|
||||
WyattForm? form,
|
||||
this.status = FormStatus.pure,
|
||||
this.errorMessage,
|
||||
});
|
||||
}) {
|
||||
this.form = form ?? WyattFormImpl(const [], name: '');
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [status, form, errorMessage];
|
||||
}
|
||||
|
@ -16,8 +16,9 @@
|
||||
|
||||
part of 'form_data_cubit_impl.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class FormDataStateImpl extends FormDataState {
|
||||
const FormDataStateImpl({
|
||||
FormDataStateImpl({
|
||||
required super.form,
|
||||
super.status = FormStatus.pure,
|
||||
super.errorMessage,
|
||||
|
Loading…
x
Reference in New Issue
Block a user