Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,18 @@ class MethodChannel {
MethodCall<T> method_call(method, std::move(arguments));
std::unique_ptr<std::vector<uint8_t>> message =
codec_->EncodeMethodCall(method_call);
messenger_->Send(name_, message->data(), message->size());
messenger_->Send(name_, message->data(), message->size(), nullptr);
}

// TODO: Add support for a version of InvokeMethod expecting a reply once
// https://github.com/flutter/flutter/issues/18852 is fixed.
// Sends a message to the Flutter engine on this channel expecting a reply.
void InvokeMethod(const std::string& method,
std::unique_ptr<T> arguments,
flutter::BinaryReply reply) {
MethodCall<T> method_call(method, std::move(arguments));
std::unique_ptr<std::vector<uint8_t>> message =
codec_->EncodeMethodCall(method_call);
messenger_->Send(name_, message->data(), message->size(), reply);
}

// Registers a handler that should be called any time a method call is
// received on this channel.
Expand Down
4 changes: 2 additions & 2 deletions shell/platform/common/cpp/client_wrapper/plugin_registrar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ void BinaryMessengerImpl::Send(const std::string& channel,
const size_t message_size,
BinaryReply reply) const {
if (reply == nullptr) {
std::cerr << "Calling BinaryMessengerImpl::Send expecting a reply, but the "
"callback is null.\n";
FlutterDesktopMessengerSend(messenger_, channel.c_str(), message,
message_size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't realize we were checking for null here. But I think this change is probably the right approach.

return;
}
struct Captures {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,7 @@ FLUTTER_EXPORT
*/
- (void)invokeMethod:(NSString*)method
arguments:(id _Nullable)arguments
result:(FlutterResult _Nullable)callback
// TODO: Add macOS support for replies once
// https://github.com/flutter/flutter/issues/18852 is fixed.
API_UNAVAILABLE(macos);

result:(FlutterResult _Nullable)callback;
/**
* Registers a handler for method calls from the Flutter side.
*
Expand Down