ConversionFailedException class

Exception thrown when an actual type conversion attempt fails.

This typically occurs when a matching converter exists, but the conversion logic encounters an error (e.g., due to incompatible values or invalid data).


Example:

throw ConversionFailedException(
  sourceType: Class.forObject(input),
  targetType: Class.of(String),
  value: input,
  cause: FormatException('Invalid number format'),
);
Inheritance
Implemented types

Constructors

ConversionFailedException({Class? sourceType, required Class targetType, Object? value, Object? point})
Exception thrown when an actual type conversion attempt fails.

Properties

cause Object?
The underlying cause of this exception, if any.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
message String
The message describing the error.
finalinherited
point Object?
The cause of the failure.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sourceType → Class?
The source type from which we tried to convert.
final
stackTrace StackTrace
The associated stack trace.
finalinherited
targetType → Class
The target type we attempted to convert to.
final
value Object?
The actual value that failed to convert.
final

Methods

getCause() Object
The cause of this exception, if any.
inherited
getMessage() String
The message associated with this exception.
inherited
getStackTrace() StackTrace
The stack trace associated with this exception.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited