diff --git a/lib/src/form_group_cubit/form_group_cubit.dart b/lib/src/form_group_cubit/form_group_cubit.dart index 9f90919..bbf0656 100644 --- a/lib/src/form_group_cubit/form_group_cubit.dart +++ b/lib/src/form_group_cubit/form_group_cubit.dart @@ -344,6 +344,16 @@ class FormGroupState with EquatableMixin { /// Returns true if fields are currently being validated. final bool validating; + /// List of this form's fields including subforms' fields. + Iterable> get allFields => + fields.followedBy(subforms.expand((e) => e.state.allFields)); + + /// Map of all validation errors (including subfroms') grouped by fields + Map, dynamic> get validationErrors => { + for (final field in allFields) + if (field.state.validationError case final error?) field: error, + }; + @override List get props => [ wasModified,