I have a simple use case where I am trying to recompute a provider providing a list of items on watching an item provider as follows :
final itemProvider = StateProvider<Item>((ref) {
return Item() ;
});
final itemListProvider = Provider<List<Item>>((ref) {
watch(itemProvider);
...//do something to compute new list
return computedList ;
});
I want the itemListProvider to recompute automatically when itemProvider's state is changed from outside so that the itemListProvider keeps on adding the new items to the existing list it provides. Is there a way to achieve this in the above particular fashion using Riverpod? I know I could use a StateNotifierProvider or StateProvider and update the itemList using a state assignment call but I am looking forward to do it reactively.
Any help or guidance is appreciated. Thanks!