> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Result.Success

> Kotlin Data Class

**Data Class**

```kotlin theme={null}
data class Success<T>(val value: T) : Result<T, Nothing>
```

## Constructors

```kotlin theme={null}
constructor(value: T)
```

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| `value`  | `T`  | -           |

## Functions

| Function     | Description                                                               |
| ------------ | ------------------------------------------------------------------------- |
| `flatMap`    | Chains a success through transform, which itself returns a Result.        |
| `fold`       | Applies onSuccess or onFailure depending on the result variant.           |
| `getOrNull`  | Returns the success value, or null if this is a Result.Failure.           |
| `getOrThrow` | Returns the success value, or throws if this is a Result.Failure.         |
| `map`        | Transforms the success value using transform, leaving failures unchanged. |
| `mapError`   | Transforms the error using transform, leaving successes unchanged.        |

### flatMap

```kotlin theme={null}
inline fun <T, E, R> Result<T, E>.flatMap(transform: (T) -> Result<R, E>): Result<R, E>
```

Chains a success through transform, which itself returns a Result.

### fold

```kotlin theme={null}
inline fun <T, E> Result<T, E>.fold(onSuccess: (T) -> Unit, onFailure: (E) -> Unit)
```

Applies onSuccess or onFailure depending on the result variant.

### getOrNull

```kotlin theme={null}
fun <T, E> Result<T, E>.getOrNull(): T?
```

Returns the success value, or null if this is a Result.Failure.

### getOrThrow

```kotlin theme={null}
fun <T, E> Result<T, E>.getOrThrow(): T
```

Returns the success value, or throws if this is a Result.Failure.

### map

```kotlin theme={null}
inline fun <T, E, R> Result<T, E>.map(transform: (T) -> R): Result<R, E>
```

Transforms the success value using transform, leaving failures unchanged.

### mapError

```kotlin theme={null}
inline fun <T, E, F> Result<T, E>.mapError(transform: (E) -> F): Result<T, F>
```

Transforms the error using transform, leaving successes unchanged.
