Skip to content

[url_launcher] Fix supportsCloseForLaunchMode to query close support - #12926

Open
NikhilKukreja26 wants to merge 5 commits into
flutter:mainfrom
NikhilKukreja26:fix-url-launcher-supports-close
Open

NikhilKukreja26 wants to merge 5 commits into
flutter:mainfrom
NikhilKukreja26:fix-url-launcher-supports-close

Conversation

@NikhilKukreja26

Copy link
Copy Markdown

Fixes flutter/flutter#192758

supportsCloseForLaunchMode was calling UrlLauncherPlatform.supportsMode
(the launch-support check) instead of supportsCloseForMode, so it reported
whether a mode can be launched rather than whether an in-app web view opened
with that mode can be closed. This changes it to call supportsCloseForMode,
and adds a regression test (the shared mock is extended so the two platform
methods can return different values).

Pre-launch Checklist

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates supportsCloseForLaunchMode to correctly query supportsCloseForMode on the platform instead of supportsMode, alongside a version bump to 6.3.3 and a new regression test. Feedback recommends allowing setCloseForModeResponse to accept a nullable bool? and adding a tearDown block to reset the mock state, ensuring proper test isolation and preventing test pollution.

Comment thread packages/url_launcher/url_launcher/test/src/url_launcher_uri_test.dart Outdated

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

Comment thread packages/url_launcher/url_launcher/test/mocks/mock_url_launcher_platform.dart Outdated
Comment thread packages/url_launcher/url_launcher/test/mocks/mock_url_launcher_platform.dart Outdated
Comment thread packages/url_launcher/url_launcher/test/src/url_launcher_uri_test.dart Outdated
Comment thread packages/url_launcher/url_launcher/test/src/url_launcher_uri_test.dart Outdated
Comment thread packages/url_launcher/url_launcher/CHANGELOG.md Outdated
@stuartmorgan-g stuartmorgan-g added the CICD Run CI/CD label Sep 18, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Sep 21, 2026
@NikhilKukreja26

Copy link
Copy Markdown
Author

Thanks for the review! Addressed all points — fresh mock via setUp, removed the fallback and nullable setter, and trimmed the CHANGELOG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[url_launcher] supportsCloseForLaunchMode calls supportsMode, so it answers "can this mode be launched" instead of "can it be closed"

2 participants