From 310ae53dfb7213b02c0f16cde5a5bd0a6bba8894 Mon Sep 17 00:00:00 2001 From: Naud Ghebre <30516046+naudzghebre@users.noreply.github.com> Date: Thu, 2 Sep 2021 18:54:46 -0400 Subject: [PATCH] The result to CompleteEmpty() being called on the platform message (flutter/engine#28407) response is being interpreted as `null` in dart. This results in a MissingPluginException being thrown whenever `View.update` or `View.dispose` is invoked. This change returns null data in a dictionary to complete the response in a way that is not interpreted as `null` in dart. --- .../shell/platform/fuchsia/flutter/platform_view.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/platform_view.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/platform_view.cc index 018c1b9482..cbd16ed9bf 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/platform_view.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/platform_view.cc @@ -866,6 +866,11 @@ bool PlatformView::HandleFlutterPlatformViewsChannelPlatformMessage( on_update_view_callback_( view_id->value.GetUint64(), view_occlusion_hint_raw, hit_testable->value.GetBool(), focusable->value.GetBool()); + if (message->response()) { + message->response()->Complete(std::make_unique( + std::vector({'[', '0', ']'}))); + return true; + } } else if (method == "View.dispose") { auto args_it = root.FindMember("args"); if (args_it == root.MemberEnd() || !args_it->value.IsObject()) { @@ -898,6 +903,11 @@ bool PlatformView::HandleFlutterPlatformViewsChannelPlatformMessage( }); }; on_destroy_view_callback_(view_id_raw, std::move(on_view_unbound)); + if (message->response()) { + message->response()->Complete(std::make_unique( + std::vector({'[', '0', ']'}))); + return true; + } } else if (method.rfind("View.focus", 0) == 0) { return focus_delegate_->HandlePlatformMessage(root, message->response()); } else {