removeFirstHistoryElement method

HistoryElement? removeFirstHistoryElement()

Removes the first element from beamingHistory and returns it.

If there is none, returns null.

Implementation

HistoryElement? removeFirstHistoryElement() {
  if (beamingHistoryCompleteLength == 0) {
    return null;
  }
  if (updateParent) {
    _parent?.removeFirstHistoryElement();
  }
  final firstBeamLocation = beamingHistory.first;
  final firstHistoryElement = firstBeamLocation.removeFirstFromHistory();
  if (firstBeamLocation.history.isEmpty) {
    _disposeBeamLocation(firstBeamLocation);
    beamingHistory.removeAt(0);
  }

  return firstHistoryElement;
}