Hi,
I've encountered unexpected behavior when using asyncValidator. Specifically:
- When
asyncValidator is used, it updates the state of FieldCubit multiple times with different statuses, which is expected.
- However, if setValue is called during an ongoing async validation, and
state.autovalidate is true, the synchronous _validator (which does not perform async calculations) is triggered.
- This causes the state to be updated with the new value.
- When the asyncValidator completes, it overrides the
FieldCubit state with the previous value, leading to unexpected behavior.
Expected Behavior:
If a new value is set while an async validation is in progress, any ongoing async state updates in FieldCubit should be canceled to prevent the state from reverting to an outdated value
I'm happy to provide more details or contribute to resolving this issue if needed.
Hi,
I've encountered unexpected behavior when using
asyncValidator. Specifically:asyncValidatoris used, it updates the state ofFieldCubitmultiple times with different statuses, which is expected.state.autovalidateis true, the synchronous_validator(which does not perform async calculations) is triggered.FieldCubitstate with the previous value, leading to unexpected behavior.Expected Behavior:
If a new value is set while an async validation is in progress, any ongoing async state updates in FieldCubit should be canceled to prevent the state from reverting to an outdated value
I'm happy to provide more details or contribute to resolving this issue if needed.