Flutter Provider:正确分发操作的最佳方法是什么?

时间:2020-06-23 16:52:51

标签: flutter dart provider

该问题与我之前的问题有关:Why can't I use context.read in build(), but I can use Provider.of with listen: false? 您说过旧的Provider.of<X>(context, listen: false)语法是不安全的。但是,它有效。

It works

我相信fetchTransactions()的方法不会改变,因此无需观看。

我不能使用context.read,因为它不在闭包中,并且会引发“不要使用context.read在构建方法中”错误。

我不能将context.watchcontext.selectFutureBuilder一起使用,因为这将导致无限的重建循环。

0 个答案:

没有答案