-
-
Notifications
You must be signed in to change notification settings - Fork 974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linter for useless ref.read
#3906
Comments
Technically that I'm not sure whether we'd truly want to ban ""useless"" reads as it's unclear whether they truly are useless or not. |
@rrousselGit can we bypass "@useResult"? That way we can explicitly say that we want that read (probably for initialization purposes) |
There's no official way to bypass it, no (besides |
I just looked, adding the @useResult seems indeed a bit strict, it could be useful in the case of a read on a autodisposed provider |
"ref.readForInit(myProvider)" Would this make sense and make things explicit? If we have family and auto dispose on the provider, can't we have notLazy to avoid valid use of "ref.read(myProvider)" in the first place? |
I'd rather not add a new API just for that. I'm trying to reduce the API surface, not increase it for very little value.
Not doable |
Do you see any better option than |
Not immediately, and I don't think that's worth the cost either. |
I found in my code a
ref.read
without a returned value capture:ref.read(myProvider)
it would be great if Riverpod linter would help detect stupid mistakes like these
The text was updated successfully, but these errors were encountered: