提交 84c167d8 编写于 作者: T tauu 提交者: Harry Terkelsen

[web_ui] add missing dispose handler for MethodCalls to flutter/platform_view (#12226)

* added dispose handler for calls to flutter/platform_view

* improved comment
上级 92d020f2
......@@ -50,6 +50,9 @@ void handlePlatformViewCall(
case 'create':
_createPlatformView(decoded, callback);
return;
case 'dispose':
_disposePlatformView(decoded, callback);
return;
}
callback(null);
}
......@@ -76,3 +79,15 @@ void _createPlatformView(
platformViewRegistry._createdViews[id] = element;
callback(codec.encodeSuccessEnvelope(null));
}
void _disposePlatformView(
MethodCall methodCall, ui.PlatformMessageResponseCallback callback) {
final int id = methodCall.arguments;
const MethodCodec codec = StandardMethodCodec();
// Remove the root element of the view from the DOM.
platformViewRegistry._createdViews[id]?.remove();
platformViewRegistry._createdViews.remove(id);
callback(codec.encodeSuccessEnvelope(null));
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册