Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/web_ui/lib/src/engine/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class EngineWindow extends ui.Window {
final Map<String, dynamic> message = decoded.arguments;
switch (decoded.method) {
case 'routePushed':
case 'routeReplaced':
_browserHistory.setRouteName(message['routeName']);
break;
case 'routePopped':
Expand Down
15 changes: 14 additions & 1 deletion lib/web_ui/test/engine/navigation_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void main() {
engine.window.locationStrategy = _strategy = null;
});

test('Tracks pushed and popped routes', () {
test('Tracks pushed, replaced and popped routes', () {
engine.window.sendPlatformMessage(
'flutter/navigation',
codec.encodeMethodCall(const engine.MethodCall(
Expand Down Expand Up @@ -62,5 +62,18 @@ void main() {
emptyCallback,
);
expect(_strategy.path, '/bar/baz');

engine.window.sendPlatformMessage(
'flutter/navigation',
codec.encodeMethodCall(const engine.MethodCall(
'routeReplaced',
<String, dynamic>{
'previousRouteName': '/bar/baz',
'routeName': '/bar/baz2',
},
)),
emptyCallback,
);
expect(_strategy.path, '/bar/baz2');
});
}