toDartFix property

String get toDartFix

When compiled to Wasm a JSStringImpl can leak to the Wasm VM and it will crash, trying to cast to a Wasm String (OneByteString).

Implementation

String get toDartFix {
  final self = this;

  if (self.isEmpty) {
    return '';
  }

  if (self.runtimeType != String) {
    // Force a Dart String.
    var b = '$_emptyString$self';
    return b;
  }

  return this;
}