hardCause property

Object? hardCause

The hard cause is some error which caused the UserException, but that is not a UserException itself. For example: int.parse('a') throws a FormatException. Then: throw UserException('Invalid number').addCause(FormatException('Invalid input')). will have the FormatException as the hard cause. Note: If a UserException is passed as the hard cause, it will be added with addCause, and will not become the hard cause. In other words, a UserException will never be a hard cause.

Implementation

Object? get hardCause {
  var exception = this;
  return (exception is AdvancedUserException) ? exception.hardCause : null;
}