[web_ui] add missing dispose handler for MethodCalls to flutter/platform_view (flutter/engine#12226)
* added dispose handler for calls to flutter/platform_view * improved comment
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user