Skip to content

Can we find a way to select only the states that need to be used, but with less code? #3963

Answered by gdurandrexel
Trung15010802 asked this question in Q&A
Discussion options

You must be logged in to vote

You can return a record. They support equality out of the box.

If any value in the record changes, the resulting record is not equal to the previous one and you are notified.

final colors = ref.watch(
      appColorsProvider.select(
        (value) => (progressValueColor: value.progressValueColor, borderColor: value.borderColor, secondBgColor: value.secondBgColor)
      ),
    );

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Trung15010802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants