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 {
@override
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 {
}
Future<dynamic> _dispose(MethodCall call) {
int id;
if (call.arguments is int) {
id = call.arguments as int;
} else if (call.arguments is Map && call.arguments['hybrid'] == true) {
id = call.arguments['id'] as int;
assert(call.arguments is Map);
final int id = call.arguments['id'] as int;
final bool hybrid = call.arguments['hybrid'] as bool;
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))
......
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