updateToActualPositions method

void updateToActualPositions()

Iterates through childrenKeyMap and updates ReorderableEntity.

The original offset and orderId of ReorderableEntity will be set to the updated offset and orderId.

At the end childrenKeyMap and childrenOrderMap are replaced with the updated maps.

Implementation

void updateToActualPositions() {
  var updatedChildrenKeyMap = <String, ReorderableEntity>{};
  var updatedChildrenOrderMap = <int, ReorderableEntity>{};

  for (final entry in childrenKeyMap.entries) {
    final updatedReorderableEntity = entry.value.positionUpdated();
    final originalOrderId = updatedReorderableEntity.originalOrderId;
    updatedChildrenOrderMap[originalOrderId] = updatedReorderableEntity;
    updatedChildrenKeyMap[entry.key] = updatedReorderableEntity;
  }

  replaceMaps(
    updatedChildrenKeyMap: updatedChildrenKeyMap,
    updatedChildrenOrderMap: updatedChildrenOrderMap,
  );
}