copyWithPrevious abstract method

AsyncValue<T> copyWithPrevious(
  1. AsyncValue<T> previous, {
  2. bool isRefresh = true,
})

Clone an AsyncValue, merging it with previous.

When doing so, the resulting AsyncValue can contain the information about multiple state at once. For example, this allows an AsyncError to contain a value, or even AsyncLoading to contain both a value and an error.

This changes the default behavior of when and sets the isReloading/ isRefreshing flags accordingly.

Implementation

AsyncValue<T> copyWithPrevious(
  AsyncValue<T> previous, {
  bool isRefresh = true,
});