replaceWith method

String replaceWith(
  1. String replace
)

Replace string of this range with another

Implementation

String replaceWith(String replace) {
  final joinedString = fullString.join('');
  if (end == fullString.length - 1) {
    // no suffix
    return '${joinedString.substring(0, start)}$replace';
  } else {
    // with suffix
    return '${joinedString.substring(0, start)}$replace${joinedString.substring(end + 1, fullString.length)}';
  }
}