wrapWith method

String wrapWith(
  1. String wrapper, {
  2. bool wrapWhenEmpty = false,
})

Implementation

String wrapWith(String wrapper, {bool wrapWhenEmpty = false}) {
  assert(wrapper.length == 2);
  if (!wrapWhenEmpty && isEmpty) {
    return this;
  }
  return wrapper[0] + this + wrapper[1];
}