ValidationResponse.fromSubResponses constructor
ValidationResponse.fromSubResponses({
- required String? validationError,
- required String? stateError,
- required List<
Response< subResponses,EventValidate, dynamic> >
Implementation
factory ValidationResponse.fromSubResponses(
{required String? validationError,
required String? stateError,
required List<Response<EventValidate, dynamic>> subResponses}) {
return ValidationResponse(
dataValidationError: validationError,
stateError: stateError,
childrenCanSave: subResponses.isEmpty ||
subResponses.every(
(element) => (element.result is! ValidationResponse || (element.result as ValidationResponse).canSave)),
childrenHaveErrors: subResponses.isNotEmpty &&
subResponses.any(
(element) => (element.result is ValidationResponse && (element.result as ValidationResponse).hasError)),
);
}