toJs()
toJs(
dart,check):any
Converts a Dart object to its JavaScript wrapper or native JS value.
Type conversion rules:
null/undefined-> passed throughFLOAT_NULLsentinel ->nullMap-> plain object with recursively converted valuesList-> array via paramsToJsDG.TypedEventArgs-> TypedEventArgs wrapperDateTime->dayjsobjectByteArray-> passed through unchangedBigInt-> JavaScriptBigInt- Objects with existing wrappers -> returns the wrapper
Property-> Property wrapper
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
dart | any | undefined | Dart object handle |
check | boolean | false | When true, throws an exception if the type cannot be converted |
Returns
any
JavaScript wrapper, native JS value, or the original Dart handle
Throws
Error if check is true and type is not supported
See
- toDart for the reverse operation
- ./dart-interop.md for full documentation