of
suspend fun <T> <Error class: unknown class>.of(supplier: suspend () -> T): <Error class: unknown class><T>
A helper function to asynchronously obtain a Result from a code block that may succeed or throw a Throwable. Upon success, the resulting value of the code block will be return as a successful Result. Upon error, the thrown Throwable will be wrapped into the returned Result instead.
Return
The Result, wrapping a T object or a Throwable.
Parameters
T
The type wrapped into the Result on success.
supplier
The code block producing the result of type T.