From 182cccbb2a35a2489cca5ee8275b30fbb1e537e0 Mon Sep 17 00:00:00 2001 From: realshovanshah <53654505+realshovanshah@users.noreply.github.com> Date: Tue, 30 Aug 2022 21:36:11 -0500 Subject: [PATCH 1/2] fix #103 ### Description This seems to be the cause of the problem but I think more tests need to be added. ### Todo - [ ] Add tests? --- lib/src/deeplink.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/deeplink.dart b/lib/src/deeplink.dart index e795dd5..451625d 100644 --- a/lib/src/deeplink.dart +++ b/lib/src/deeplink.dart @@ -57,7 +57,8 @@ class DeepLinkParser { final parameters = []; 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); From 22f23d7fe6a32ff93f074af6e385773ae5bd9b7e Mon Sep 17 00:00:00 2001 From: Shovan Shah Date: Tue, 11 Oct 2022 06:11:40 -0500 Subject: [PATCH 2/2] test: empty path params --- test/deeplink_test.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/deeplink_test.dart b/test/deeplink_test.dart index ee815bb..ba49844 100644 --- a/test/deeplink_test.dart +++ b/test/deeplink_test.dart @@ -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');