Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 540bee5

Browse files
committed
dartdocs
1 parent 1fd6456 commit 540bee5

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

lib/web_ui/lib/src/engine/history/js_url_strategy.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ JsUrlStrategy? convertToJsUrlStrategy(UrlStrategy? strategy) {
3333
pushState: allowInterop(strategy.pushState),
3434
replaceState: allowInterop(strategy.replaceState),
3535
go: allowInterop(strategy.go),
36-
// getBaseHref: allowInterop(strategy.getBaseHref),
3736
);
3837
}
3938

@@ -78,7 +77,4 @@ abstract class JsUrlStrategy {
7877

7978
/// Moves forwards or backwards through the history stack.
8079
external Future<void> go(int count);
81-
82-
// TODO: add this:
83-
// external String getBaseHref();
8480
}

lib/web_ui/lib/src/engine/history/url_strategy.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class HashUrlStrategy extends UrlStrategy {
134134
/// [UrlStrategy] when they need to interact with the DOM apis like
135135
/// pushState, popState, etc...
136136
abstract class PlatformLocation {
137-
///
137+
/// This constructor is here only to allow subclasses to be const.
138138
const PlatformLocation();
139139

140140
/// Registers an event listener for the `onpopstate` event.
@@ -183,11 +183,14 @@ abstract class PlatformLocation {
183183
///
184184
/// See: https://developer.mozilla.org/en-US/docs/Web/API/History/go
185185
void go(int count);
186+
187+
/// The base href where the flutter app is being served.
188+
String? getBaseHref();
186189
}
187190

188191
/// An implementation of [PlatformLocation] for the browser.
189192
class BrowserPlatformLocation extends PlatformLocation {
190-
///
193+
/// Default constructor for [BrowserPlatformLocation].
191194
const BrowserPlatformLocation();
192195

193196
html.Location get _location => html.window.location;
@@ -229,4 +232,7 @@ class BrowserPlatformLocation extends PlatformLocation {
229232
void go(int count) {
230233
_history.go(count);
231234
}
235+
236+
@override
237+
String? getBaseHref() => html.document.baseUri;
232238
}

lib/web_ui/lib/src/engine/window.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -801,10 +801,7 @@ class EngineWindow extends ui.Window {
801801
}
802802

803803
void _addUrlStrategyListener() {
804-
// TODO(mdebbar): Do we need "allowInterop" here?
805-
_onUrlStrategy = allowInterop((JsUrlStrategy strategy) {
806-
setUrlStrategy(strategy);
807-
});
804+
_onUrlStrategy = setUrlStrategy;
808805
registerHotRestartListener(() {
809806
_onUrlStrategy = null;
810807
});

0 commit comments

Comments
 (0)