get method
T
get()
Returns data if this request hasData. If the request has no data a StateError is thrown.
Implementation
T get() {
if (!isOk) {
throw StateError('Request is not OK: $statusCode\n$body');
}
if (!hasData) {
throw StateError('Request has no data: $statusCode\n$body');
}
return data!;
}