Skip to content

Commit 9b4847f

Browse files
authored
[pigeon] fix: Apply correct ThrowError success callback (#11585)
Building in Visual Studio 2026 gives the following error: ``` error C2664: 'void core_tests_pigeontest::FlutterIntegrationCoreApi::ThrowError(std::function<void (const flutter::EncodableValue *)> &&,std::function<void (const core_tests_pigeontest::FlutterError &)> &&)': cannot convert argument 1 from 'test_plugin::TestPlugin::CallFlutterThrowError::<lambda_1>' to 'std::function<void (const flutter::EncodableValue *)> &&' ``` This is likely due to https://stackoverflow.com/a/79894278/5164462 so the compiler does not allow unsuited call parameters. Towards flutter/flutter#185597 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent cac0fc5 commit 9b4847f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/pigeon/platform_tests/test_plugin/windows/test_plugin.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,9 @@ void TestPlugin::CallFlutterThrowError(
746746
std::function<void(ErrorOr<std::optional<flutter::EncodableValue>> reply)>
747747
result) {
748748
flutter_api_->ThrowError(
749-
[result](const std::optional<flutter::EncodableValue>& echo) {
750-
result(echo);
749+
[result](const flutter::EncodableValue* echo) {
750+
result(echo ? std::optional<flutter::EncodableValue>(*echo)
751+
: std::nullopt);
751752
},
752753
[result](const FlutterError& error) { result(error); });
753754
}

0 commit comments

Comments
 (0)