convertToResult

fun <T : Any, R : Any> convertToResult(data: T? = null, error: R? = null): Result<T, R>

Wraps a passed data (or) error into appropriate Result object. Note: Only one param is expected to be passed.

Parameters

data

, the data that is wrapped as Result.Success.value

error

, the error-data that is wrapped as Result.Failure.value