0

The question is related to my previous question: Why can't I use context.read in build(), but I can use Provider.of with listen: false? You said that an old Provider.of<X>(context, listen: false) syntax is unsafe. However, it works.

It works

I believe fetchTransactions() method won't change, so there's no need to watch it.

I can't use context.read because it's not in the closure and will throw the "don't use context.read in a build method" error.

I can't use context.watch or context.select with FutureBuilder, because it will cause an infinite rebuild loop.

Sergey Molchanovsky
  • 587
  • 1
  • 4
  • 10

0 Answers0