errorStatusCode property

String get errorStatusCode

Error status code — also checks the backend response body.

Implementation

String get errorStatusCode {
  final code = statusCodeValue;
  if (code != null) return '$code';

  final body = _errorBody;
  if (body != null) {
    // RFC 7807 problem+json
    final status =
        body['status'] ??
        body['Status'] ??
        body['statusCode'] ??
        body['StatusCode'];
    if (status != null) return '$status';
  }

  if (dioError != null) return _errorTypeLabel(dioError!.type);
  return 'Error';
}