Skip to content

fix(windows): add missing == 0 to openAppSettings compare - #1571

Open
ibrahim-iqbal wants to merge 4 commits into
Baseflow:mainfrom
ibrahim-iqbal:fix/1564-windows-openappsettings-compare
Open

ibrahim-iqbal wants to merge 4 commits into
Baseflow:mainfrom
ibrahim-iqbal:fix/1564-windows-openappsettings-compare

Conversation

@ibrahim-iqbal

@ibrahim-iqbal ibrahim-iqbal commented Oct 12, 2026 •

Copy link
Copy Markdown

Fixes #1564

Bug

In permission_handler_windows_plugin.cpp:

} else if (methodName.compare("shouldShowRequestPermissionRationale") == 0
        || methodName.compare("openAppSettings")) {

std::string::compare returns 0 on a match. The second operand is missing == 0, so it evaluates to the non-zero (truthy) comparison result for every method name except "openAppSettings" — swapping the two arms of the condition:

  • openAppSettings is the only method name that falls through to result->NotImplemented() → MissingPluginException on the Dart side, instead of a result.
  • Every genuinely unrecognized method name instead matches this branch and silently returns Success(false), instead of reporting NotImplemented — hiding real gaps from callers.

Fix

One-character fix: add == 0 to the second compare, restoring both behaviors — openAppSettings now returns Success(false) like shouldShowRequestPermissionRationale, and unrecognized methods correctly report NotImplemented.

Testing

No Windows device available to run this locally; the fix is a direct correction of the documented logic inversion (std::string::compare semantics are unambiguous here, and the diff is one token).

)

std::string::compare returns 0 on a match, so the second operand of
the || was always true except when methodName was literally
"openAppSettings" — swapping the two arms. openAppSettings fell
through to NotImplemented() (a MissingPluginException on the Dart
side instead of a result), while every other unrecognized method
name was silently handled as Success(false), hiding real
NotImplemented gaps from callers.
@ibrahim-iqbal
ibrahim-iqbal force-pushed the fix/1564-windows-openappsettings-compare branch from 6cc97d4 to a4bf3e6 Compare October 12, 2026 06:28
codivo-erill added a commit to codivo-erill/flutter-permission-handler that referenced this pull request Nov 3, 2026
openAppSettings fell through to NotImplemented because of a missing
'== 0' in the method name compare (see Baseflow#1571). Open ms-settings:privacy
via ShellExecuteW instead, like geolocator_windows does.
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.42%. Comparing base (0241e81) to head (49440e9).
⚠️ Report is 1 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (0241e81) and HEAD (49440e9). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (0241e81) HEAD (49440e9)
unittests 2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1571       +/-   ##
===========================================
- Coverage   89.84%   71.42%   -18.42%     
===========================================
  Files           7        1        -6     
  Lines         128       35       -93     
===========================================
- Hits          115       25       -90     
+ Misses         13       10        -3     
Flag Coverage Δ
unittests 71.42% <ø> (-18.42%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Missing == 0 inverts the openAppSettings check in permission_handler_windows_plugin.cpp

1 participant