From 6d6016381779a0c5dc29f3811d0ed065d92de6ec Mon Sep 17 00:00:00 2001 From: Jonas Heinle Date: Tue, 18 Aug 2026 19:10:59 +0200 Subject: [PATCH 1/2] [windows] Fix clang-cl compilation of the Windows plugin MSVC accepts the implicit conversion from EncodableMap to EncodableValue when calling MethodResult::Success(), but clang-cl does not and fails with "no matching member function for call to 'Success'". Wrap the map in an explicit flutter::EncodableValue, which compiles under both toolchains. Also drops an unused `this` capture from the Geolocator.PositionChanged lambda, which clang-cl reports as -Wunused-lambda-capture. Bumps permission_handler_windows to 0.2.3. The app-facing package needs no change: its existing `permission_handler_windows: ^0.2.2` constraint already allows 0.2.3. Co-Authored-By: Claude Opus 5 (1M context) --- permission_handler_windows/CHANGELOG.md | 5 +++++ permission_handler_windows/pubspec.yaml | 2 +- .../windows/permission_handler_windows_plugin.cpp | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/permission_handler_windows/CHANGELOG.md b/permission_handler_windows/CHANGELOG.md index f951b347d..9de37faf2 100644 --- a/permission_handler_windows/CHANGELOG.md +++ b/permission_handler_windows/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.2.3 + +* Fixes compilation with `clang-cl` (LLVM) by explicitly wrapping the request results map in a `flutter::EncodableValue` before passing it to `result->Success()`. +* Removes an unused `this` capture from the `Geolocator.PositionChanged` lambda, which triggered `-Wunused-lambda-capture`. + ## 0.2.2 * Added support for the new Android 17 permission `ACCESS_LOCAL_NETWORK` diff --git a/permission_handler_windows/pubspec.yaml b/permission_handler_windows/pubspec.yaml index b01412999..7f9594c67 100644 --- a/permission_handler_windows/pubspec.yaml +++ b/permission_handler_windows/pubspec.yaml @@ -1,6 +1,6 @@ name: permission_handler_windows description: Permission plugin for Flutter. This plugin provides the Windows API to request and check permissions. -version: 0.2.2 +version: 0.2.3 homepage: https://github.com/baseflow/flutter-permission-handler flutter: diff --git a/permission_handler_windows/windows/permission_handler_windows_plugin.cpp b/permission_handler_windows/windows/permission_handler_windows_plugin.cpp index 4b4d6d184..51cac81d0 100644 --- a/permission_handler_windows/windows/permission_handler_windows_plugin.cpp +++ b/permission_handler_windows/windows/permission_handler_windows_plugin.cpp @@ -88,7 +88,7 @@ void PermissionHandlerWindowsPlugin::RegisterWithRegistrar( PermissionHandlerWindowsPlugin::PermissionHandlerWindowsPlugin(){ m_positionChangedRevoker = geolocator.PositionChanged(winrt::auto_revoke, - [this](Geolocator const& geolocator, PositionChangedEventArgs e) + [](Geolocator const& geolocator, PositionChangedEventArgs e) { }); } @@ -139,7 +139,9 @@ void PermissionHandlerWindowsPlugin::HandleMethodCall( requestResults.insert({EncodableValue(permissions[i]), EncodableValue((int)permissionStatus)}); } - result->Success(requestResults); + // Explicitly wrap the map in an EncodableValue. MSVC accepts the implicit + // conversion, but clang-cl does not and fails to find a matching overload. + result->Success(EncodableValue(requestResults)); } else if (methodName.compare("shouldShowRequestPermissionRationale") == 0 || methodName.compare("openAppSettings")) { result->Success(EncodableValue(false)); From a76fa90a1ca70028ae22e33befff0593124bcb5a Mon Sep 17 00:00:00 2001 From: Jonas Heinle Date: Tue, 18 Aug 2026 22:25:18 +0200 Subject: [PATCH 2/2] [windows] Silence the warnings clang-cl turns into errors Flutter's generated app compiles plugins with /W4 /WX, and two things in this file fail that under clang-cl: * the request loop compared an int index against permissions.size(); * the PositionChanged handler ignores both of its parameters. MSVC stays quiet because Flutter passes /wd"4100", but clang-cl does not apply that quoted form and errors with -Wunused-parameter. Co-Authored-By: Claude Opus 5 (1M context) --- permission_handler_windows/CHANGELOG.md | 3 ++- .../windows/permission_handler_windows_plugin.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/permission_handler_windows/CHANGELOG.md b/permission_handler_windows/CHANGELOG.md index 9de37faf2..16c53c586 100644 --- a/permission_handler_windows/CHANGELOG.md +++ b/permission_handler_windows/CHANGELOG.md @@ -1,7 +1,8 @@ ## 0.2.3 * Fixes compilation with `clang-cl` (LLVM) by explicitly wrapping the request results map in a `flutter::EncodableValue` before passing it to `result->Success()`. -* Removes an unused `this` capture from the `Geolocator.PositionChanged` lambda, which triggered `-Wunused-lambda-capture`. +* Removes the unused `this` capture and the unused parameter names from the `Geolocator.PositionChanged` lambda, which triggered `-Wunused-lambda-capture` and `-Wunused-parameter`. +* Iterates the requested permissions with a `size_t` index, fixing the signed/unsigned comparison warning that `/W4 /WX` builds turn into an error. ## 0.2.2 diff --git a/permission_handler_windows/windows/permission_handler_windows_plugin.cpp b/permission_handler_windows/windows/permission_handler_windows_plugin.cpp index 51cac81d0..8c4860ba2 100644 --- a/permission_handler_windows/windows/permission_handler_windows_plugin.cpp +++ b/permission_handler_windows/windows/permission_handler_windows_plugin.cpp @@ -88,7 +88,7 @@ void PermissionHandlerWindowsPlugin::RegisterWithRegistrar( PermissionHandlerWindowsPlugin::PermissionHandlerWindowsPlugin(){ m_positionChangedRevoker = geolocator.PositionChanged(winrt::auto_revoke, - [](Geolocator const& geolocator, PositionChangedEventArgs e) + [](Geolocator const&, PositionChangedEventArgs) { }); } @@ -134,7 +134,7 @@ void PermissionHandlerWindowsPlugin::HandleMethodCall( EncodableMap requestResults; - for (int i=0;i