errors property Null safety

Map<String, Object> errors
override

Gets all errors of the group.

Contains all the errors of the group and the child errors.

Implementation

@override
Map<String, Object> get errors {
  final allErrors = Map<String, Object>.of(super.errors);
  _controls.forEach((name, control) {
    if (control.enabled && control.hasErrors) {
      allErrors.update(
        name,
        (_) => control.errors,
        ifAbsent: () => control.errors,
      );
    }
  });

  return allErrors;
}