visitAsExpression method
Visit a SAsExpression.
Implementation
@override
Object? visitAsExpression(SAsExpression node) {
final value = node.expression!.accept<Object?>(this);
final result = _tryCast(value, node.type);
if (!identical(result, _castFailed)) return result;
final typeDesc = _castTypeDescription(node.type);
final valueDesc = value?.runtimeType.toString() ?? 'Null';
throw D4rtTypeError(
"Cast failed with 'as' : value of type $valueDesc cannot be cast to $typeDesc",
);
}