[英]Flutter Consumer not rebuilding UI using riverpod StateNotifierProvider
Its my 1st time using riverpod and for practice purposes, I'm making to-do app.这是我第一次使用 riverpod,出于练习目的,我正在制作待办事项应用程序。 I'm using StateNotifierProvider and it's not updating the ListViewBuilder but updating the length of items but not showing that item.
我正在使用 StateNotifierProvider 并且它不是更新 ListViewBuilder 而是更新项目的长度但不显示该项目。 Please Guide me, Here is the SC of StateNotifier
请指导我,这是 StateNotifier 的 SC
and here is the calling method to call add method here is the SC这是调用添加方法的调用方法,这里是 SC
and here is the UI UPDATING THE NUMBERS OF items but not updating the list.这是更新项目数量但不更新列表的用户界面。
I solved my issue:我解决了我的问题:
void addtask(String? newtask) {
final task = TaskModel(name: newtask!);
state = [...state, task];
} }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.