D4UnwrapException class
Exception thrown by D4.unwrapAs when an interpreter result cannot be
converted to the requested native type T.
Carries enough context (the requested type description, the actual runtime type, and an optional source description) to make the failure actionable for embedders that translate interpreter results to native Dart values.
Example:
try {
final widget = D4.unwrapAs<Widget>(result, visitor: visitor);
} on D4UnwrapException catch (e) {
print(e); // -> Expected Widget but got String (from raw value)
}
- Inheritance
-
- Object
- D4rtException
- D4UnwrapException
Constructors
- D4UnwrapException({required String expectedType, required String actualType, String? source, String? extra})
- Creates a new unwrap exception.
Properties
- actualType → String
-
String description of the value's actual runtime type.
final
- expectedType → String
-
String description of the expected type (typically
T.toString()).final - hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
The error message.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source → String?
-
Optional human-readable description of where the value came from
(e.g.
BridgedInstance<Widget>orInterpretedInstance(MyClass)).final - trackedStackTrace ↔ StackTrace?
-
Stack trace captured by ErrorReporter when tracking is enabled.
getter/setter pairinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
revoke(
) → bool -
Revokes this error from the ErrorReporter.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited