diff --git a/test/ably_flutter_plugin_test.dart b/test/ably_flutter_plugin_test.dart index a5d8004ce..c4fe6aa40 100644 --- a/test/ably_flutter_plugin_test.dart +++ b/test/ably_flutter_plugin_test.dart @@ -15,7 +15,10 @@ void main() { const _nativeLibraryVersion = '1.1.0'; setUp(() { - channel.setMockMethodCallHandler((methodCall) async { + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( + channel, + (methodCall) async { switch (methodCall.method) { case PlatformMethod.resetAblyClients: return true; @@ -39,7 +42,8 @@ void main() { }); tearDown(() { - channel.setMockMethodCallHandler(null); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(channel, null); }); test(PlatformMethod.getPlatformVersion, () async {