This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +9
-10
lines changed
lib/web_ui/lib/src/engine Expand file tree Collapse file tree 3 files changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,6 @@ JsUrlStrategy? convertToJsUrlStrategy(UrlStrategy? strategy) {
33
33
pushState: allowInterop (strategy.pushState),
34
34
replaceState: allowInterop (strategy.replaceState),
35
35
go: allowInterop (strategy.go),
36
- // getBaseHref: allowInterop(strategy.getBaseHref),
37
36
);
38
37
}
39
38
@@ -78,7 +77,4 @@ abstract class JsUrlStrategy {
78
77
79
78
/// Moves forwards or backwards through the history stack.
80
79
external Future <void > go (int count);
81
-
82
- // TODO: add this:
83
- // external String getBaseHref();
84
80
}
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ class HashUrlStrategy extends UrlStrategy {
134
134
/// [UrlStrategy] when they need to interact with the DOM apis like
135
135
/// pushState, popState, etc...
136
136
abstract class PlatformLocation {
137
- ///
137
+ /// This constructor is here only to allow subclasses to be const.
138
138
const PlatformLocation ();
139
139
140
140
/// Registers an event listener for the `onpopstate` event.
@@ -183,11 +183,14 @@ abstract class PlatformLocation {
183
183
///
184
184
/// See: https://developer.mozilla.org/en-US/docs/Web/API/History/go
185
185
void go (int count);
186
+
187
+ /// The base href where the flutter app is being served.
188
+ String ? getBaseHref ();
186
189
}
187
190
188
191
/// An implementation of [PlatformLocation] for the browser.
189
192
class BrowserPlatformLocation extends PlatformLocation {
190
- ///
193
+ /// Default constructor for [BrowserPlatformLocation] .
191
194
const BrowserPlatformLocation ();
192
195
193
196
html.Location get _location => html.window.location;
@@ -229,4 +232,7 @@ class BrowserPlatformLocation extends PlatformLocation {
229
232
void go (int count) {
230
233
_history.go (count);
231
234
}
235
+
236
+ @override
237
+ String ? getBaseHref () => html.document.baseUri;
232
238
}
Original file line number Diff line number Diff line change @@ -801,10 +801,7 @@ class EngineWindow extends ui.Window {
801
801
}
802
802
803
803
void _addUrlStrategyListener () {
804
- // TODO(mdebbar): Do we need "allowInterop" here?
805
- _onUrlStrategy = allowInterop ((JsUrlStrategy strategy) {
806
- setUrlStrategy (strategy);
807
- });
804
+ _onUrlStrategy = setUrlStrategy;
808
805
registerHotRestartListener (() {
809
806
_onUrlStrategy = null ;
810
807
});
You can’t perform that action at this time.
0 commit comments