Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
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
15 changes: 15 additions & 0 deletions lib/web_ui/lib/src/engine/platform_views.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ void handlePlatformViewCall(
case 'create':
_createPlatformView(decoded, callback);
return;
case 'dispose':
_disposePlatformView(decoded, callback);
return;
}
callback(null);
}
Expand All @@ -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));
}