flutter - 可以mapEventToState同一个实例
问题描述
我们必须在 mapEventToState 中创建新的状态实例吗?像https://github.com/felangel/bloc/blob/master/examples/flutter_form_validation/lib/bloc/my_form_bloc.dart#L31我们有一个copyWith
如果我们只是这样做
state.email=event.email;
yield state;
怎么了?用户界面没有更新?
如果我们有嵌套对象怎么办?state.a.b.c
,需要多少个copyWith?
我正在使用,swagger-codegen
所以a
并没有 copyWith 方法,为我所有生成的对象实现 copyWith 太麻烦了b
c
如何轻松更改属性?
解决方案
推荐阅读
- r - 绘图上的悬停文本不正确
- maven - Intellij,有没有办法自动向 pom 添加依赖项?
- python - Python,我应该如何记录来自多个子进程的错误?
- bash - Bash 脚本命令和摆脱 shellcheck 错误 SC2181
- sql - SQL 条件选择 - 我可以使用 Case 语句吗
- java - 替换但未询问的项目
- solr - 删除多个节点红色流 - Raspberry Pi LAMP Hack
- java - 按索引Java对二维数组进行排序
- materialize - 如何在 Materialise 卡片操作中右对齐按钮
- jquery - Shopify - Jquery 没有先加载