quote property Null safety

String? quote

Quotes the String adding "" at the start & at the end.

Removes all " characters from the String before adding the quotes.

Example

String text = '"""Is this real"';
String quote = text.quote; // "Is this real"

Implementation

String? get quote {
  if (this == null) {
    return null;
  }
  if (this!.isEmpty) {
    return this;
  }
  String normalizedString = this!.replaceAll('"', '');

  return normalizedString.append('"').prepend('"');
}