recast<E> method

ListDiffs<E> recast<E>(
  1. ListDiffArguments<E> args
)

Implementation

ListDiffs<E> recast<E>(ListDiffArguments<E> args) {
  return ListDiffs<E>.ofOperations(
      this.operations.map((final op) {
        if (op is DeleteDiff) {
          return DeleteDiff<E>(args, op.index, op.size);
        } else if (op is InsertDiff) {
          return InsertDiff<E>(args, op.index!, op.size, op.items.cast<E>());
        } else if (op is ReplaceDiff) {
          return ReplaceDiff<E>(args, op.index!, op.size, op.items.cast<E>());
        } else {
          throw "Unknown type";
        }
      }).toList(growable: false),
      args);
}