абстрактный метод replaceRange
Заменяет подстроку от start до end на replacement.
Создаёт новую строку, эквивалентную:
this.substring(0, start) + replacement + this.substring(end)
Пример:
const string = 'Dart is fun'; final result = string.replaceRange(8, null, 'open source'); print(result); // Dart is open source
Индексы start и end должны задавать допустимый диапазон этой строки. То есть 0 <= start <= end <= this.length. Если end равно null, по умолчанию используется length.
Реализация
String replaceRange(int start, int? end, String replacement);
© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.19.6/dart-core/String/replaceRange.html