我正在使用提供程序包来检测“todaysTasks”的变化,但正如您所见,“todayTasks”取决于存储 DayTasks 列表的 DaysRecords,所以我想要的是每当我推送 DayTask 时重建我的根小部件(即 MyApp)在 DaysRecords.recordsList 中,但无法找到任何方法来做到这一点。这个有什么解决办法吗??
class MyApp extends StatelessWidget {
static const routeName = '/root';
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
DayTasks todaysTasks = DaysRecords.recordsList.last;
return ChangeNotifierProvider(
create: (context) => todaysTasks,