Unverified Commit 7d7907e6 authored by Maurice Parrish's avatar Maurice Parrish Committed by GitHub

Fix bug where dispose message requires a map (#61035)

parent 5f496547
...@@ -1041,7 +1041,11 @@ class TextureAndroidViewController extends AndroidViewController { ...@@ -1041,7 +1041,11 @@ class TextureAndroidViewController extends AndroidViewController {
@override @override
Future<void> _sendDisposeMessage() { Future<void> _sendDisposeMessage() {
return SystemChannels.platform_views.invokeMethod<void>('dispose', viewId); return SystemChannels
.platform_views.invokeMethod<void>('dispose', <String, dynamic>{
'id': viewId,
'hybrid': false,
});
} }
} }
......
...@@ -214,11 +214,15 @@ class FakeAndroidPlatformViewsController { ...@@ -214,11 +214,15 @@ class FakeAndroidPlatformViewsController {
} }
Future<dynamic> _dispose(MethodCall call) { Future<dynamic> _dispose(MethodCall call) {
int id; assert(call.arguments is Map);
if (call.arguments is int) {
id = call.arguments as int; final int id = call.arguments['id'] as int;
} else if (call.arguments is Map && call.arguments['hybrid'] == true) { final bool hybrid = call.arguments['hybrid'] as bool;
id = call.arguments['id'] as int;
if (hybrid && !_views[id].hybrid) {
throw ArgumentError('An $AndroidViewController using hybrid composition must pass `hybrid: true`');
} else if (!hybrid && _views[id].hybrid != null && _views[id].hybrid) {
throw ArgumentError('An $AndroidViewController not using hybrid composition must pass `hybrid: false`');
} }
if (!_views.containsKey(id)) if (!_views.containsKey(id))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment