You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a scenario when editing an already existing record, there is a need to initialize initial values for FieldBlocs. The first validation seems to happen on creating FormBloc. Values are empty at that point, so if field is required, State.error has error message. When SingleFieldBloc.updateInitialValue performs successful validation of new value, it calls
emit(state.copyWith(
...
error: Param(error),
...
))
where error is NULL.
The TextFieldBlocState.copyWith implementation is like this:
error: error == null ? this.error : error.value,
so when error is NULL it just keeps an old error message instead of reset it to null. As result the valid form submission fails.
The text was updated successfully, but these errors were encountered:
In a scenario when editing an already existing record, there is a need to initialize initial values for FieldBlocs. The first validation seems to happen on creating FormBloc. Values are empty at that point, so if field is required, State.error has error message. When SingleFieldBloc.updateInitialValue performs successful validation of new value, it calls
emit(state.copyWith(
...
error: Param(error),
...
))
where error is NULL.
The TextFieldBlocState.copyWith implementation is like this:
error: error == null ? this.error : error.value,
so when error is NULL it just keeps an old error message instead of reset it to null. As result the valid form submission fails.
The text was updated successfully, but these errors were encountered: