My expectation is that validateAll only triggers validation on fields that have changed from their initial value. Currently, if setAutovalidate(true) is used, setting any field in the entire form causes all other fields to be validated. If their initial values don't pass the validation (which is very often the case), validation errors are emitted. I would expect the below test to pass, because fieldA has not changed.
test(
'validation triggered to validateAll only affects fields that have had setValue called on them',
() async {
final fieldA = TextFieldCubit<bool>(validator: (_) => false);
final fieldB = TextFieldCubit<bool>(validator: (_) => false);
final formCubit = FormGroupCubit(validateAll: true)
..registerFields([fieldA, fieldB]);
await Future.microtask(
() => formCubit.setAutovalidate(true),
); // This is required due to https://github.com/leancodepl/leancode_forms/issues/29
await Future<void>.delayed(Duration.zero);
fieldB.setValue('Any value');
await Future<void>.delayed(Duration.zero);
expect(fieldA.state.isValid, true);
});