insertArtifactForSpace method

void insertArtifactForSpace({
  1. required List<Artifact> artifacts,
  2. required int insertAtIndex,
  3. required int cols,
  4. required int rows,
  5. required IntOffset locationFoundAt,
})

Inserts a space artifact at a specified position in the artifacts list.

This method creates a new empty Artifact representing a space character and inserts it into the provided artifacts list at the specified index.

Parameters: artifacts: The list of artifacts to insert the space into. insertAtIndex: The index at which to insert the space artifact. cols: The width of the space artifact in columns. rows: The height of the space artifact in rows. locationFoundAt: The position where the space artifact should be placed.

Implementation

void insertArtifactForSpace({
  required final List<Artifact> artifacts,
  required final int insertAtIndex,
  required final int cols,
  required final int rows,
  required final IntOffset locationFoundAt,
}) {
  final Artifact artifactSpace = Artifact.fromMatrix(Artifact(cols, rows));
  artifactSpace.matchingCharacter = ' ';
  artifactSpace.locationFound = locationFoundAt;
  artifacts.insert(insertAtIndex, artifactSpace);
}