扑动集实现偏差
我正在尝试实现一个类似的应用程序与称为JAPA Counter的计数器应用程序,它具有其他功能以减少计数器。它还保持了巡回赛数量和BEED的数量。如果计数器计数(BEEDS计数)达到108时,回合计数会增加,而Beeds计数将初始化为零。依此类推。
最初,我将SetState用于状态管理,在“+”上实现非常直接,将调用计数类和' - '' - 将调用dectementCounter函数,
学习BLOC,使用Bloc相同实现该功能,但由于事件,状态模型我再也无法使用增量counter,decormentCounter方法了,我必须依靠构造函数才能更改状态,如下面的链接,
https://github.com/gopikrishnapuligundla/japa_counter
有没有办法我仍然使用cormementCounter,dectementCounter。
我担心的是,集体模式使业务逻辑变得非常偏差。我的意思是增加我更喜欢增量范围而不是具有新值的构造函数。
I am trying to implement a similar app to counter app called japa counter , it has additional functionality to decrement counter . as well it maintains number of rounds and beeds . where when counter(beeds count)goes to 108 , rounds count get incremented and beeds count would initialise to zero. and so on..
initially i used setState for state management , it is quite straight forward to implement on '+' will call incrementCounter function of Counter class and on '-' will call decrementCounter function ,
to learn bloc , implemented the same using bloc , but as it is event , state model i can no more use incrementCounter , decrementCounter methods , i have to depend on constructor to change state as in the below link ,
https://github.com/gopiKrishnaPuligundla/japa_counter
is there a way i still use incrementCounter , decrementCounter.
my worry is bloc pattern is making the business logic quite deviated .i mean for increment i prefer incrementCounter than constructor with new values.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是我对原因的上述问题所理解的。
Riverpod州管理具有类似的概念史坦替函数。
RiverPod还支持ChangeNotifier(有助于通知对象的变化(可变))
RiverPod建议将statenotifier与不可变的物体一起使用,这类似于上述BLOC逻辑,原因是我们也对以前的状态有所处理,这在调试中是一个很大的好处,测试框架。
仍然会添加ChangeNotifier在创建新对象时添加性能。
他们在上面提到的选择过滤器在Riverpod中无法使用changeNotifier工作
this is what i understood about above questions on why .
Riverpod state management has similar concept stateNotifier.(it helps in notifying change in state of a notifier by creating new state object(immutable))
Riverpod also support changeNotifier (it helps notify change in object (mutable))
Riverpod suggests to use stateNotifier with immutable objects which is similar to bloc logic above mentioned , reason being we have handle for previous state as well , which is a great benefit in debugging , testing frameworks.
still changeNotifier adds performance as it wont create new objects.
as well they mention above select filters wont work in riverpod with changeNotifier