concat method

Delta concat(
  1. Delta other, {
  2. bool trimNewLine = false,
})

Concatenates other with this delta and returns the result.

Implementation

Delta concat(Delta other, {bool trimNewLine = false}) {
  final result = Delta.from(this);
  if (trimNewLine) {
    result._trimNewLine();
  }
  if (other.isNotEmpty) {
    // In case first operation of other can be merged with last operation in
    // our list.
    result.push(other.operations.first);
    result.operations.addAll(other.operations.sublist(1));
  }
  return result;
}