didStartUserGesture method

void didStartUserGesture()

The navigator is being controlled by a user gesture.

For example, called when the user beings an iOS back gesture.

When the gesture finishes, call didStopUserGesture.

Implementation

void didStartUserGesture() {
  _userGesturesInProgress += 1;
  if (_userGesturesInProgress == 1) {
    final int routeIndex = _getIndexBefore(
      _history.length - 1,
      _RouteEntry.willBePresentPredicate,
    );
    final Route<dynamic> route = _history[routeIndex].route;
    Route<dynamic>? previousRoute;
    if (!route.willHandlePopInternally && routeIndex > 0) {
      previousRoute = _getRouteBefore(
        routeIndex - 1,
        _RouteEntry.willBePresentPredicate,
      )!.route;
    }
    for (final NavigatorObserver observer in _effectiveObservers) {
      observer.didStartUserGesture(route, previousRoute);
    }
  }
}