riverpod icon indicating copy to clipboard operation
riverpod copied to clipboard

AsyncError.value should return null instead of throwing

Open rrousselGit opened this issue 2 years ago • 3 comments

And valueOrNull should be removed

This is to better support pattern matching, as folks are bound to mistakenly use value instead of valueOrNull

rrousselGit avatar Oct 15 '23 21:10 rrousselGit

Currently when someone uses AsyncValue.value the error recovery is poor sometimes if valueOrNull should have been used. (the value was null at runtime) Will the removal of valueOrNull from AsyncValue/AsyncError fix this?

navaronbracke avatar Oct 18 '23 09:10 navaronbracke

I'm not exactly sure what you're referring to. But if "valueOrNull" should've been used instead of "value", then yes. This issue is effectively about deleting the old value and renaming valueOrNull -> value.

rrousselGit avatar Oct 19 '23 14:10 rrousselGit

That was indeed what I was implying yes.

navaronbracke avatar Oct 19 '23 14:10 navaronbracke

Was implemented in the dev branch

rrousselGit avatar Mar 01 '24 11:03 rrousselGit