wrapWith method

  1. @useResult
String? wrapWith({
  1. String? before,
  2. String? after,
})

Returns this string wrapped with before prepended and after appended, or null if the string is empty.

Implementation

@useResult
String? wrapWith({String? before, String? after}) {
  if (isEmpty) {
    return null;
  }

  return '${before ?? ''}$this${after ?? ''}';
}