toEither
Converts the receiver AsyncResult to an Either. It will use the Error as the value on the left side of the Either and the Success as the value on the right side of the Either.
inline suspend fun <E, R> Flow<AsyncResult<R>>.toEither(errorTransform: (Error) -> E = {
it.metadataOrNull<E>()
?: error(
"Unexpected error type: $it. " +
"Expected ${E::class.simpleName}. Provide your own errorTransform function to handle this case.",
)
}): Either<E, R>
Converts the receiver AsyncResult to an Either. By default, it will try to use the error in the from the Error.metadata value. In case you want to specify your own error type, you can use the errorTransform function.