getAllFieldsOfForm method

Iterable<FormGroupField> getAllFieldsOfForm({
  1. required String formName,
  2. bool mountedOnly = false,
  3. bool includeIgnored = false,
})

mountedOnly if true, this will return only the fields that are currently mounted into a widget tree

Implementation

Iterable<FormGroupField> getAllFieldsOfForm({
  required String formName,
  bool mountedOnly = false,
  bool includeIgnored = false,
}) {
  final list = _formGroups[formName]?._fields.values.where(
        (f) {
          if (includeIgnored) {
            return true;
          }
          return !f.name.isIgnoredInForm();
        },
      ).toList() ??
      <FormGroupField>[];
  if (mountedOnly) {
    return list.where((f) => f.isMounted).toList();
  }
  return list;
}