Minor fix

This commit is contained in:
2023-11-28 16:17:09 +08:00
parent 91a447b016
commit f432967c12
6 changed files with 4 additions and 29 deletions

View File

@@ -1 +0,0 @@
export 'replace_current_route_none.dart' if (dart.library.html) 'replace_current_route_web.dart';

View File

@@ -1,3 +0,0 @@
void replaceCurrentRoute(String query) {
throw UnimplementedError();
}

View File

@@ -1,13 +0,0 @@
// ignore: avoid_web_libraries_in_flutter
import 'dart:html';
void replaceCurrentRoute(String query) {
const usePathUrl = bool.fromEnvironment("usePathUrl");
if (usePathUrl) {
final q = query.substring(1);
final base = document.baseUri ?? "/";
window.history.replaceState(null, "", "$base$q");
} else {
window.history.replaceState(null, "", "#$query");
}
}