popBeamLocation method

bool popBeamLocation()

Beams to previous location in beamLocationHistory and removes the last location from history.

If there is no previous location, does nothing.

Returns the success, whether the currentBeamLocation was changed.

Implementation

bool popBeamLocation() {
  if (!canPopBeamLocation) {
    return false;
  }
  _currentBeamLocation.removeListener(_updateFromLocation);
  beamLocationHistory.removeLast();
  _currentBeamLocation = beamLocationHistory.last;
  beamStateHistory.add(_currentBeamLocation.state.copyWith());
  _currentBeamLocation.addListener(_updateFromLocation);
  update(
    transitionDelegate: beamBackTransitionDelegate,
  );
  return true;
}