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 46d8777 commit 0a79c08
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@

import 'dart:html';

import 'package:flutter_web_plugins/url_strategy.dart';

import 'url_service.dart';

class WebUrlService extends UrlService {
@override
String? getPath() {
final href = window.location.href;

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

return '/';
return null;
}
}

Expand Down
2 changes: 2 additions & 0 deletions flutter_modular/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ dependencies:
result_dart: ">=1.0.4 <2.0.0"
flutter:
sdk: flutter
flutter_web_plugins:
sdk: flutter

dev_dependencies:
flutterando_analysis: ^0.0.2
Expand Down

0 comments on commit 0a79c08

Please sign in to comment.