// Are these the same?
final model = Provider.of<Model>(context, listen: false);
final model = context.read<Model>();
// Are these the same?
final model = Provider.of<Model>(context);
final model = context.watch<Model>();
Are they the same or aren't they? If they are, then why do I get this error when I use read
inside the build()
method, while Provider.of()
works?
Tried to use
context.read<Model>
inside either abuild
method or theupdate
callback of a provider.