forked from firka/flutter
Fix bug where dispose message requires a map (#61035)
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user