relocateSystem<S extends SceneSystem<T>> method

void relocateSystem<S extends SceneSystem<T>>(
  1. int index
)

Moves the first found system of type S to the specified index. No-op if no system of type S is found. Clamps index to the valid range of the list.

Implementation

void relocateSystem<S extends SceneSystem<T>>(int index) {
  final currentIndex = _systems.indexWhere((s) => s is S);
  if (currentIndex == -1) return;

  final system = _systems.removeAt(currentIndex);
  final clampedIndex = index.clamp(0, _systems.length);
  _systems.insert(clampedIndex, system);
}