JSString.fromString constructor

JSString.fromString(
  1. String? string
)

Creates a JavaScript string from dart String. string The dart String.

Implementation

JSString.fromString(String? string) {
  if (string == null) {
    _pointer = nullptr;
  } else {
    var cString = string.toNativeUtf8();
    _pointer = JSStringRef.jSStringCreateWithUTF8CString(cString);
    malloc.free(cString);
  }
}