ConversionException class
Exception thrown when a type conversion fails in a ConversionService.
This typically occurs when attempting to convert an object from one type to another
and no suitable Converter or GenericConverter
exists, or the conversion logic
throws an error due to invalid data or incompatible types.
❗ Example:
try {
final value = conversionService.convert<String>(42, String);
} catch (e) {
if (e is ConversionException) {
print('Conversion failed: ${e.message}');
}
}
Use this to catch and handle specific conversion failures during property binding, message deserialization, or data mapping.
- Inheritance
- Implemented types
- Implementers
Constructors
- ConversionException(String message)
- Exception thrown when a type conversion fails in a ConversionService.
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
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace
-
The associated stack trace.
finalinherited
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.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited