unwrapPrevious method
The opposite of copyWithPrevious
, reverting to the raw AsyncValue
with no information on the previous state.
Implementation
AsyncValue<ValueT> unwrapPrevious() {
final that = this;
return switch (that) {
AsyncValue(isLoading: true) ||
AsyncLoading() => AsyncLoading<ValueT>(progress: that.progress),
AsyncData() => AsyncData<ValueT>(that.value),
AsyncError() => AsyncError<ValueT>(that.error, that.stackTrace),
};
}