From e833f0f272b1878091b46a1db8c3ae5dbafc59c9 Mon Sep 17 00:00:00 2001 From: Michalina Majewska Date: Wed, 5 Jun 2024 14:44:27 +0200 Subject: [PATCH] Use lazy iterable --- lib/src/form_group_cubit/form_group_cubit.dart | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/src/form_group_cubit/form_group_cubit.dart b/lib/src/form_group_cubit/form_group_cubit.dart index ff23bc1..bbf0656 100644 --- a/lib/src/form_group_cubit/form_group_cubit.dart +++ b/lib/src/form_group_cubit/form_group_cubit.dart @@ -345,12 +345,8 @@ class FormGroupState with EquatableMixin { final bool validating; /// List of this form's fields including subforms' fields. - Iterable> get allFields { - return [ - ...fields, - for (final subform in subforms) ...subform.state.allFields, - ]; - } + 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 => {