During refresh, it was made so that instead of emitting an AsyncLoading, the provider would emit an AsyncData/AsyncError corresponding to the previous state; but with isLoading=true/isRefreshing=true.
This was due to an implementation detail of how AsyncValue.when/map work.
But this impacts features like whenData/asData negatively. From experience, this is confusing to folks.
We could fix that behaviour such that an AsyncLoading is always emitted, with either isRefreshing or isReloading set.
Considerations
We'd have to double check how this impacts pattern matches.
Currently folks can do:
switch ()
AsyncData(:final value) =>,
AsyncError(:final error) =>,
_ =>,
which will show previous data during refreshes but not show previous data during reloads.
This wouldn't behave like this anymore with the new behavior, and would instead show data/error only once they completed.
To match this behavior, folks would have to do:
switch ()
AsyncValue(:final value?, isReloading: false) =>,
AsyncValue(:final error?, isReloading: false) =>,
_ =>,
Omitting the isReloading: false would have the switch show data/error during reloads (ref.watch updates).
During refresh, it was made so that instead of emitting an AsyncLoading, the provider would emit an AsyncData/AsyncError corresponding to the previous state; but with isLoading=true/isRefreshing=true.
This was due to an implementation detail of how
AsyncValue.when/mapwork.But this impacts features like
whenData/asDatanegatively. From experience, this is confusing to folks.We could fix that behaviour such that an AsyncLoading is always emitted, with either isRefreshing or isReloading set.
Considerations
We'd have to double check how this impacts pattern matches.
Currently folks can do:
which will show previous data during refreshes but not show previous data during reloads.
This wouldn't behave like this anymore with the new behavior, and would instead show data/error only once they completed.
To match this behavior, folks would have to do:
Omitting the
isReloading: falsewould have the switch show data/error during reloads (ref.watch updates).