You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some use case with subtree override.
For example I have a layerProvider.
Override it for LayerPage.
Navigator.push AnotherLayerPage, and of course the provider been override not accessible.
And I found ProviderScope(parent:) is deprecated and seems not work.
So is there any way to workaround it? (Sample code below)
The real use case, is like I have a todoListProvider, which read/watch a repositroyProvider.
So I can sometimes access remote Todo list, sometimes with local storage, not at the same.
The RemoteRepository and LocalRepository share the same BaseRepository interface.
The subtree override is my best try for now, because in that case I only have one single TodoListNotifier for both use case.
Another option seems use family, but ref.watch(todoListProvider(someRepositroy)) doesn't feel right, does it need another layer of provider to cover the injection? I don't know🤔.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
🎉🎉🎉Happy new year everyone 🎉🎉🎉
I have some use case with subtree override.
For example I have a layerProvider.
Override it for LayerPage.
Navigator.push AnotherLayerPage, and of course the provider been override not accessible.
And I found ProviderScope(parent:) is deprecated and seems not work.
So is there any way to workaround it? (Sample code below)
The real use case, is like I have a todoListProvider, which read/watch a repositroyProvider.
So I can sometimes access remote Todo list, sometimes with local storage, not at the same.
The RemoteRepository and LocalRepository share the same BaseRepository interface.
The subtree override is my best try for now, because in that case I only have one single TodoListNotifier for both use case.
Another option seems use family, but
ref.watch(todoListProvider(someRepositroy))
doesn't feel right, does it need another layer of provider to cover the injection? I don't know🤔.Sample Code:
Beta Was this translation helpful? Give feedback.
All reactions