File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
lib/src/infra/services/url_service Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import 'dart:html' ;
4
4
5
+ import 'package:flutter_modular/flutter_modular.dart' ;
6
+ import 'package:flutter_web_plugins/url_strategy.dart' ;
7
+
5
8
import 'url_service.dart' ;
6
9
7
10
class WebUrlService extends UrlService {
8
11
@override
9
- String ? getPath () => resolvePath (window.location.href);
12
+ String ? getPath () {
13
+ final href = window.location.href;
14
+
15
+ if (urlStrategy is HashUrlStrategy ) {
16
+ if (href.endsWith (Modular .initialRoute)) {
17
+ return Modular .initialRoute;
18
+ } else if (href.contains ('#' )) {
19
+ return href.split ('#' ).last;
20
+ }
21
+ }
22
+
23
+ return resolvePath (href);
24
+ }
10
25
}
11
26
12
27
UrlService create () {
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ dependencies:
12
12
result_dart : " >=1.0.4 <2.0.0"
13
13
flutter :
14
14
sdk : flutter
15
+ flutter_web_plugins :
16
+ sdk : flutter
15
17
16
18
dev_dependencies :
17
19
flutterando_analysis : ^0.0.2
You can’t perform that action at this time.
0 commit comments