HashUrlStrategy class Null safety
Uses the browser URL's hash fragments to represent its state.
By default, this class is used as the URL strategy for the app. However, this class is still useful for apps that want to extend it.
In order to use HashUrlStrategy for an app, it needs to be set like this:
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
// Somewhere before calling `runApp()` do:
setUrlStrategy(const HashUrlStrategy());
- Inheritance
-
- Object
- UrlStrategy
- HashUrlStrategy
- Implementers
Constructors
- HashUrlStrategy([PlatformLocation _platformLocation = const BrowserPlatformLocation()])
-
Creates an instance of HashUrlStrategy.
const
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
addPopStateListener(
EventListener fn) → VoidCallback -
Adds a listener to the
popstate
event and returns a function that, when invoked, removes the listener.override -
getPath(
) → String -
Returns the active path in the browser.
override
-
getState(
) → Object? -
The state of the current browser history entry.
override
-
go(
int count) → Future< void> -
Moves forwards or backwards through the history stack.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
prepareExternalUrl(
String internalUrl) → String -
Given a path that's internal to the app, create the external url that
will be used in the browser.
override
-
pushState(
Object? state, String title, String url) → void -
Push a new history entry.
override
-
replaceState(
Object? state, String title, String url) → void -
Replace the currently active history entry.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited