Reputation: 1315
I feel myself copying a lot of the same code using Riverpod. An example, if I have something like this:
...modelList.when(
data: (data) { display page when data returns },
loading: () { display disabled version of page until data returns} ,
error: (error, st) { display page with error message },
)
I find myself displaying the a version of the page in 3 different places. This feels very repetitive and I feel I must be doing something wrong. Suggestions?
Upvotes: 0
Views: 75
Reputation: 6000
How do you propose you could solve this in less code?
You need to handle different states in your app; I'm unsure how you could do that without specifying the desired behavior for each state.
You aren't doing anything wrong. Try using bloc (for example) and you will see that Riverpod is really lightweight for what it provides.
Upvotes: 1