value property

T get value

The value result of this CompletableFuture.

Trying to get the result, while isCompleted or hasCompletedWithValue is false will throw a StateError.

Implementation

T get value {
  switch (result) {
    case final CompletableFutureValue<T> v:
      return v.value;

    case CompletableFutureError<T>():
      throw StateError(
        "This CompletableFuture completed with an error "
        "and not a value.",
      );
  }
}