removeLastHistoryElement method

HistoryElement? removeLastHistoryElement()

Removes the last element from beamingHistory and returns it.

If there is none, returns null.

Implementation

HistoryElement? removeLastHistoryElement() {
  if (beamingHistoryCompleteLength == 0) {
    return null;
  }
  if (updateParent) {
    _parent?.removeLastHistoryElement();
  }
  final lastHistoryElement = beamingHistory.last.removeLastFromHistory();
  if (beamingHistory.last.history.isEmpty) {
    _disposeBeamLocation(beamingHistory.last);
    beamingHistory.removeLast();
  } else {
    beamingHistory.last.update(null, null, null, false);
  }

  return lastHistoryElement;
}