Baseflow / Baseflow/flutter-permission-handler

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

Open Beginner friendly
#1,564 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
2.2k
Forks
970
Avg merge
14h 22m
Merged PRs (30d)
2

Description

### Please check the following before submitting a new issue.

- [x] I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues).
- [x] I have carefully [read the documentation](https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler/README.md) and verified I have added the required platform specific configuration.

### Please select affected platform(s)

- [ ] Android
- [ ] iOS
- [x] Windows

### Steps to reproduce

Found during code review. At https://github.com/Baseflow/flutter-permission-handler/blob/fc60b52afbd076d90f25ee950952cbd434e88595/permission_handler_windows/windows/permission_handler_windows_plugin.cpp#L144 the second operand of the || is written as `methodName.compare("openAppSettings")` without `== 0`.

### Expected results

The user-visible effect is that calling openAppSettings() on Windows throws a MissingPluginException on the Dart side rather than returning a value — so apps that offer an "open settings" action after a permanent denial hit an exception on Windows — and, conversely, genuinely unsupported methods silently succeed with false instead of reporting NotImplemented, hiding real gaps from callers.

### Actual results

Since std::string::compare returns 0 on a match, that expression is false precisely when the method is openAppSettings and true for every other name, which swaps the two arms of the condition: openAppSettings is the only method that falls through to result->NotImplemented(), while every unrecognized method name is instead handled and returns Success(false).

### Code sample

It's an obvious logic typo, found during code review. Observed in permission_handler_windows 0.2.2, pulled in transitively by permission_handler 13.0.2.

Adding `== 0` to line 144 restores both behaviors.

### Screenshots or video

_No response_

### Version

13.0.2

### Flutter Doctor output

Doctor output

```console
$ flutter doctor -v
[√] Flutter (Channel stable, 3.47.2, on Microsoft Windows [Version 10.0.26200.9445], locale en-US) [421ms]
• Flutter version 3.47.2 on channel stable at C:\ProgramData\flutter\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision d3b14c8769 (2 weeks ago), 2026-08-26 16:07:51 -0700
• Engine revision a804b26164
• Dart version 3.13.2
• DevTools version 2.60.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets,
enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[√] Windows Version (Windows 11 or higher, 25H2, 2009) [1,781ms]

[!] Android toolchain - develop for Android devices (Android SDK version 37.0.0) [618ms]
• Android SDK at C:\Users\dale\AppData\Local\Android\sdk
• Emulator version 37.1.11.0 (build_id 15917651) (CL:N/A)
• Platform android-37.0, build-tools 37.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 25.0.3+-15898627-b508.16)
X Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/to/windows-android-setup for more details.

[√] Chrome - develop for the web [106ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.40) [105ms]
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.14.37628.2
• Windows 10 SDK version 10.0.26100.0

[√] Connected device (4 available) [628ms]
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 13 (API 33) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26200.9445]
• Chrome (web) • chrome • web-javascript • Google Chrome 153.0.8010.37
• Edge (web) • edge • web-javascript • Microsoft Edge 150.0.4078.83

[√] Network resources [756ms]
• All expected network resources are available.

! Doctor found issues in 1 category.
```

Contributor guide

Open the contributing guide

Research direction

Start in permission_handler_windows/windows/permission_handler_windows_plugin.cpp at line 144 and inspect the method-name condition around openAppSettings. Verify the behavior for openAppSettings and an unsupported method, then run the Windows plugin tests if available. Done means openAppSettings no longer falls through to MissingPluginException and unsupported methods still report NotImplemented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, flutter
Domain
desktop
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
92/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.