Is it okay to make a nested ConsumerStatefulWidget in a single screen? Each ConsumerStatefulWidget has ref.watch(someAsyncNotifierProvider) in it.
>Solution :
It’s perfectly acceptable. The key is to watch providers only where necessary, ensuring efficient state management.
To optimize rebuilds, you can:
- Create providers that expose only specific aspects of the state your widget depends on.
- Use Consumer to rebuild only certain child widgets when the provider’s value changes.
- If you’re using hooks, select can be very useful for conditional rebuilding.