Skip to content

Instantly share code, notes, and snippets.

@bistole
Last active January 29, 2021 20:27
Show Gist options
  • Select an option

  • Save bistole/d11764c8d1743243377a7ec9b882108d to your computer and use it in GitHub Desktop.

Select an option

Save bistole/d11764c8d1743243377a7ec9b882108d to your computer and use it in GitHub Desktop.
register binary messenger
using namespace flutter;
void Commands::registerMessenger(BinaryMessenger* binary_messenger)
{
std::string channel_name(PACKAGE_NAME);
channel_name += COMMANDS;
const StandardMethodCodec& codec = StandardMethodCodec::GetInstance();
method_channel_ = new MethodChannel<EncodableValue>(binary_messenger, channel_name, &codec);
method_channel_->SetMethodCallHandler([this](
const MethodCall<EncodableValue>& call,
std::unique_ptr<MethodResult<EncodableValue>> result) {
this->methodChannelHandler(call, result);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment