urlStrategy top-level property

UrlStrategy? urlStrategy

Returns the present UrlStrategy for handling the browser URL.

Returns null when the browser integration has been manually disabled.

Implementation

UrlStrategy? get urlStrategy =>
    isCustomUrlStrategySet ? _customUrlStrategy : _defaultUrlStrategy;
void urlStrategy=(UrlStrategy? strategy)

Sets a custom URL strategy instead of the default one.

Passing null disables browser history integration altogether.

This setter can only be called once. Subsequent calls will throw an error in debug mode.

Implementation

set urlStrategy(UrlStrategy? strategy) {
  assert(
    _customUrlStrategyCanBeSet,
    'Cannot set URL strategy a second time or after the app has been initialized.',
  );
  preventCustomUrlStrategy();
  isCustomUrlStrategySet = true;
  _customUrlStrategy = strategy;
}