jsToCString function

String jsToCString(
  1. Pointer<JSContext> ctx,
  2. Pointer<JSValue> val
)

Implementation

String jsToCString(
  Pointer<JSContext> ctx,
  Pointer<JSValue> val,
) {
  final ptr = _jsToCString(ctx, val);
  if (ptr.address == 0) throw Exception('JSValue cannot convert to string');
  final str = ptr.toDartString();
  jsFreeCString(ctx, ptr);
  return str;
}