unwrapInterpreterValue static method
Unwrap an interpreter value to its native representation.
- BridgedInstance → BridgedInstance.nativeObject
- BridgedEnumValue → BridgedEnumValue.nativeValue
- All other values (null, String, num, bool, List, Map, etc.) pass through unchanged.
Note: Lists and Maps are NOT recursively unwrapped because doing so
destroys Dart's reified generic type information. For example,
Map<String, String> would become Map<Object?, Object?> after
.map(). If a callback returns a List/Map containing BridgedInstance
values, the generated bridge code must handle the element-level
unwrapping explicitly.
Implementation
static Object? unwrapInterpreterValue(Object? value) {
if (value is BridgedInstance) {
return value.nativeObject;
}
if (value is BridgedEnumValue) {
return value.nativeValue;
}
return value;
}