Метод replaceFirst
Создаёт новую строку, заменяя первое вхождение from на to.
Находит первое совпадение from в этой строке, начиная с startIndex, и создаёт новую строку, где это совпадение заменяется строкой to.
Пример:
'0.0001'.replaceFirst(RegExp(r'0'), ''); // '.0001' '0.0001'.replaceFirst(RegExp(r'0'), '7', 1); // '0.7001'
Реализация
String replaceFirst(Pattern from, String to, [int startIndex = 0]);
© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.18.5/dart-core/String/replaceFirst.html