Skip to content

Commit

Permalink
fix: handle path strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
camrongiuliani committed Feb 26, 2024
1 parent 0a79c08 commit 98c9188
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import 'dart:html';

import 'package:flutter_modular/flutter_modular.dart';
import 'package:flutter_web_plugins/url_strategy.dart';

import 'url_service.dart';
Expand All @@ -11,13 +12,15 @@ class WebUrlService extends UrlService {
String? getPath() {
final href = window.location.href;

if (urlStrategy is PathUrlStrategy) {
return resolvePath(href);
} else if (href.contains('#')) {
return href.split('#').last;
if (urlStrategy is HashUrlStrategy) {
if (href.endsWith(Modular.initialRoute)) {
return Modular.initialRoute;
} else if (href.contains('#')) {
return href.split('#').last;
}
}

return null;
return resolvePath(href);
}
}

Expand Down

0 comments on commit 98c9188

Please sign in to comment.