wrapSingleQuotes method

  1. @useResult
String wrapSingleQuotes({
  1. bool quoteEmpty = false,
})

Returns this string wrapped in single quotes: 'string'.

If the string is empty, returns '' if quoteEmpty is true, otherwise returns an empty string.

Implementation

@useResult
String wrapSingleQuotes({bool quoteEmpty = false}) {
  if (isEmpty) {
    return quoteEmpty ? '\'\'' : '';
  }

  return "'$this'";
}