I am trying to emit a state more than one time because I am validating a form no need to add any thing on the constructor and make copyWith func etc..
so could you help me with other solutions?
class PersonUnValid extends PersonState {
const PersonUnValid();
@override
List<Object> get props => [];
}
void validate() {
personKey.currentState!.save();
if (Formz.validate(personForm.inputs) == FormzStatus.valid) {
emit(const PersonValid());
return;
}
emit(PersonUnValid());
}
emit()
will not emit a new state, if it (the state) is identical. This is by design. See:What do you expect the UI should change when the state is the same?