wrapWith method

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

Extension method to wrap a String with a prefix before and a suffix after. Returns null if the string is empty.

Implementation

String? wrapWith({String? before, String? after}) {
  if (isEmpty) {
    return null;
  }
  return '${before ?? ""}$this${after ?? ""}';
}