I'm trying to update a value inside my Provider from outside the UI, as described in the docs:
final container = riverpod.ProviderContainer();
AppProvider _appProvider = container.read(appProvider);
_appProvider.setMode(true);
Inside my setMode method I call notifyListeners(). Now the problem is that my Widgets don't rebuild, even though the value in my provider successfully changed and notified its listeners. The widgets are listening like this:
riverpod.Consumer(builder: (context, watch, child) {
AppProvider _appProvider = watch(appProvider);
...
When updating the provider from inside the UI, the widgets are rebuild as expected.
What do I have to do to make my UI rebuild correctly in this case aswell?