toLoading method
Returns a new AsyncState representing the loading state.
Use this to transition to a loading state from any other state.
data carries over, so a refresh can keep showing the previous value
while the next one loads. when and whenData take their loading
branch regardless; read data directly to show it.
errorState is dropped: a state that is loading is not an error state.
Implementation
@override
AsyncState<S> toLoading() =>
AsyncState<S>._(status: AsyncStatus.loading, data: data);