BrowserHistory constructor

BrowserHistory(
  1. {String basename: '',
  2. bool forcedRefresh: false,
  3. int keyLength: 6,
  4. Confirmation getConfirmation,
  5. Window window}
)

Implementation

BrowserHistory(
    {String basename = '',
    bool forcedRefresh = false,
    int keyLength = 6,
    Confirmation getConfirmation,
    html.Window window})
    : _forceRefresh = forcedRefresh,
      _getConfirmation = getConfirmation,
      _keyLength = keyLength {
  _window = window ?? html.window;
  _domUtils = DomUtils(windowImpl: _window);
  if (!_domUtils.canUseDom) {
    throw StateError('Browser History needs a DOM');
  }
  _getConfirmation ??= _domUtils.getConfirmation;
  _globalHistory = _window.history;
  _basename =
      basename != null ? stripTrailingSlash(addLeadingSlash(basename)) : '';
  _popMode = PopMode.normal;

  _location = _domLocation(_historyState);
  _action = Action.pop;
  _allKeys = [_location.key];

  _transitionManager = BrowserTransitionManager(
      popStateChangeHandler: _handlePopState,
      hashChangeHandler: _handleHashChange,
      needsHashChangeHandler: !_domUtils.supportsPopStateOnHashChange);
}