-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Closed
Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Overview
EncodableValue overrides conversion constructor from std::variant to avoid implicit conversion: https://github.com/flutter/engine/blob/93da4784765158a89e269cdea36b2ba7fab85a27/shell/platform/common/client_wrapper/include/flutter/encodable_value.h#L190-L199.
Although MSVC compiler chooses a different constructor, it seems reasonable to use the API the intended way, for example camera.cpp in camera_windows plugin: https://github.com/flutter/plugins/blob/5159d5ec00478950a8ce24945a73a9567e4b9aaa/packages/camera/camera_windows/windows/camera.cpp#L156-L161.
Proposal
Explicitly calling EncodableValue constructor in:
- https://github.com/flutter/packages/blob/6bd9c7fdbd5ae053706b5ae7b64b62ea4f4b44b9/packages/pigeon/lib/cpp_generator.dart#L568
- https://github.com/flutter/packages/blob/6bd9c7fdbd5ae053706b5ae7b64b62ea4f4b44b9/packages/pigeon/lib/cpp_generator.dart#L639
- https://github.com/flutter/packages/blob/6bd9c7fdbd5ae053706b5ae7b64b62ea4f4b44b9/packages/pigeon/lib/cpp_generator.dart#L657
- https://github.com/flutter/packages/blob/6bd9c7fdbd5ae053706b5ae7b64b62ea4f4b44b9/packages/pigeon/lib/cpp_generator.dart#L661
Fix to:
indent.writeln('flutter::EncodableValue(reply(wrapped));');Fix to:
indent.writeln(
'WriteValue(flutter::EncodableValue(std::any_cast<${customClass.name}>(*custom_value).ToEncodableMap()), stream);');Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version