Skip to content

Commit f53f7c9

Browse files
authored
Merge pull request #998 from tairoroberto/master
fix: update Deep Link query parameters and add tests
2 parents cceffc1 + c8bb7a6 commit f53f7c9

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

flutter_modular/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
## [6.3.4] - 2025-03-31
2-
- FIX: prevent navigation block when device time is adjusted backward
1+
## [6.3.4] - 2025-05-02
2+
- Fix Deep Link query parameters
33

44
## [6.3.3] - 2024-04-08
55
- Fix Deep Link

flutter_modular/lib/src/presenter/navigation/modular_route_information_parser.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ class ModularRouteInformationParser
5555
path = location;
5656
}
5757

58-
return selectBook(path);
58+
return selectBook(
59+
path,
60+
arguments: routeInformation.uri.queryParameters,
61+
);
5962
}
6063

6164
@override

flutter_modular/test/src/presenter/navigation/modular_route_information_parser_test.dart

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,27 @@ void main() {
8282
expect(book.chapters().first.name, '/');
8383
});
8484

85+
test('parseRouteInformation calls selectBook with correct arguments',
86+
() async {
87+
final routeMock = ParallelRouteMock();
88+
final params = {'param': 'value'};
89+
final uri = Uri.parse('/test');
90+
when(() => routeMock.uri).thenReturn(uri);
91+
when(() => routeMock.parent).thenReturn('');
92+
when(() => routeMock.middlewares).thenReturn([]);
93+
when(() => getRoute.call(any()))
94+
.thenAnswer((_) async => Success(routeMock));
95+
when(() => getArguments.call())
96+
.thenReturn(Success(ModularArguments(uri: uri, data: params)));
97+
when(() => reportPush(routeMock)).thenReturn(const Success(unit));
98+
99+
const routeInformation = RouteInformation(location: '/test?param=value');
100+
final book = await parser.parseRouteInformation(routeInformation);
101+
102+
expect(book.uri.toString(), '/test');
103+
expect(parser.getArguments.call().getOrNull()?.data, params);
104+
});
105+
85106
test('selectBook with parents', () async {
86107
final routeMock = ParallelRouteMock();
87108
when(() => routeMock.uri).thenReturn(Uri.parse('/test'));

0 commit comments

Comments
 (0)