当我使用Equatable时,如何发射空状态多次以上
我试图发出多次状态,因为我正在验证一种表格,不需要在构造函数上添加任何东西并制作复制功能
。
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());
}
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());
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
emit()
如果(状态)相同,则不会发出新状态。这是设计。请参阅:当状态相同时,您期望UI应该更改?
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?