replaceRange method

void replaceRange(
  1. String replacement,
  2. Position from, [
  3. Position? to,
  4. String? origin,
])

Replace the part of the document between from and to with the given string. to can be left off to simply insert the string at position from.

When origin is given, it will be passed on to "change" events, and its first letter will be used to determine whether this change can be merged with previous history events, in the way described for selection origins.

Implementation

void replaceRange(String replacement, Position from,
    [Position? to, String? origin]) {
  callArgs(
      'replaceRange',
      origin != null
          ? [replacement, from.toProxy(), to!.toProxy(), origin]
          : [replacement, from.toProxy(), to?.toProxy()]);
}