requireValue method
T
requireValue()
Returns the body value or throws the selected attempt failure.
Result-returning adapters can inspect primaryFailure and project it into their own report, while value-returning callers use this single shared conversion so cleanup precedence cannot drift between entry paths.
Implementation
T requireValue() {
final failure = primaryFailure;
if (failure != null) {
Error.throwWithStackTrace(failure.error, failure.stackTrace);
}
if (!completed) {
throw StateError('Attempt body completed without a result.');
}
return value as T;
}