wrap method

String wrap(
  1. String prefix, [
  2. String? suffix
])

Wraps the string with prefix and suffix. If suffix is not provided, prefix is used as suffix.

Examples:

  • 'hello'.wrap("*") returns 'hello'
  • 'html'.wrap('<', '>') returns ''

Implementation

String wrap(String prefix, [String? suffix]) =>
    '$prefix$this${suffix ?? prefix}';