Why a Provider need a Ref to expose its State? #1102
Answered
by
rrousselGit
XuanTung95
asked this question in
Q&A
-
Describe the solution you'd like As I understand, a Provider holds a State, a Ref attaches itself to a Provider to listen to State change. |
Beta Was this translation helpful? Give feedback.
Answered by
rrousselGit
Jan 20, 2022
Replies: 1 comment 4 replies
-
Providers do not hold state, they are completely immutable. The state is stored somewhere else (ProviderContainer). That's why you can override providers or scope a value for a part of the widget tree |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
XuanTung95
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Providers do not hold state, they are completely immutable. The state is stored somewhere else (ProviderContainer).
Providers are merely a unique key that allows accessing the state.
That's why you can override providers or scope a value for a part of the widget tree