routePop static method

bool routePop(
  1. BuildContext context,
  2. BeamerDelegate delegate,
  3. RouteInformationSerializable state,
  4. BeamPage poppedPage,
)

Pops the last route from history and calls BeamerDelegate.update.

Implementation

static bool routePop(
  BuildContext context,
  BeamerDelegate delegate,
  RouteInformationSerializable state,
  BeamPage poppedPage,
) {
  if (delegate.beamingHistoryCompleteLength < 2) {
    return false;
  }

  delegate.removeLastHistoryElement();
  final previousHistoryElement = delegate.removeLastHistoryElement()!;

  delegate.update(
    configuration: previousHistoryElement.routeInformation.copyWith(),
  );

  return true;
}