replaceOneArtifactWithMore method

void replaceOneArtifactWithMore(
  1. Artifact artifactToReplace,
  2. List<Artifact> artifactsToInsert
)

Replaces a single artifact with multiple artifacts in the band.

This method removes the specified artifact from the band's artifact list and inserts the provided list of artifacts at the same position. It also clears cached statistics since the band's composition has changed.

Parameters: artifactToReplace: The artifact to be removed from the band. artifactsToInsert: The list of artifacts to insert in its place.

Implementation

void replaceOneArtifactWithMore(
  final Artifact artifactToReplace,
  final List<Artifact> artifactsToInsert,
) {
  int index = artifacts.indexOf(artifactToReplace);
  artifacts.removeAt(index);
  artifacts.insertAll(index, artifactsToInsert);
  clearStats();
}