Skip to content

Commit

Permalink
Merge pull request #104 from nubank/realshovanshah-patch-1
Browse files Browse the repository at this point in the history
fix #103
  • Loading branch information
leoiacovini authored Oct 11, 2022
2 parents d7848a9 + 22f23d7 commit eca88fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/deeplink.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class DeepLinkParser<A extends Object?> {
final parameters = <String>[];
final deepLinkPath = getPath(deepLink);
final regExp = pathToRegExp(template, parameters: parameters);
final match = regExp.matchAsPrefix(deepLinkPath)!;
final match = regExp.matchAsPrefix(deepLinkPath);
if (match == null) return {};
final parametersMap = extract(parameters, match);
return parametersMap.map((k, v) {
return MapEntry(ReCase(k).camelCase, v);
Expand Down
5 changes: 5 additions & 0 deletions test/deeplink_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ void main() {
});
});

test('on getting empty path param', () {
final result = parser.getPathParams('my-route?another-one=hello');
expect(result, {});
});

test('on getting the query params', () {
final result =
parser.getQueryParams('my-route/something?another-one=hello');
Expand Down

0 comments on commit eca88fb

Please sign in to comment.