Skip to content

[pigeon] Explicitly wrap EncodableMap in EncodableValue in C++ generated code #111722

Description

@HakkyuKim

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:

Fix to:

indent.writeln('flutter::EncodableValue(reply(wrapped));');

Fix to:

indent.writeln(
    'WriteValue(flutter::EncodableValue(std::any_cast<${customClass.name}>(*custom_value).ToEncodableMap()), stream);');

Metadata

Metadata

Labels

P2Important issues not at the top of the work listp: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions