apiError property

APIError? get apiError

Implementation

APIError? get apiError {
  final self = this;
  if (self is! VideoErrorWithCause) return null;

  final cause = self.cause;
  if (cause is! ApiException) return null;

  final body = cause.message;
  if (body == null || body.isEmpty) return null;

  try {
    return APIError.fromJson(jsonDecode(body));
  } catch (_) {
    return null;
  }
}