Combining Stream providers #3554
Unanswered
chris-rutkowski
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm looking for the best practises when chaining + mapping stream providers. Code:
The first provider userFriendsListProvider displays the list of friends very nicely, while responding to loading state and errors.
But I have a concerns about the second provider, userFriendProvider that I wish to develop following best architectural standards. I managed to develop the today version that works fine in most circumstances, but I believe the ideal is the one I'm looking for.
orElse: () => Stream.value(null)
I believe this doesn't forward nicely loading and error events fromuserFriendsListProvider
, but just return null values, while at the same time I want to get rid of optionality here.Please advise if I'm moving in the right direction.
Some additional insights:
userFriendProvider
but that's why I'm asking about best architecture. Why should I watch the low level layer (repo), instead of medium one -userFriendsListProvider
. Currently that provider doesn't do much, but imagine there is some heavy-duty post processing - I'd like to have heavy-duty done once and later just return the single element if available.AsyncValue<Friend> userFriend(UserFriendRef ref, UserId friendId) {
? But I'm a bit lost if I should ever declare myStream
providers asAsyncValue
or is this type just a result of watching/reading a provider.Beta Was this translation helpful? Give feedback.
All reactions