From d0a350c324366ea41c93756085356c460d7280c9 Mon Sep 17 00:00:00 2001 From: amebahead Date: Thu, 12 Feb 2026 17:34:15 +0900 Subject: [PATCH] Fixed MissingPluginException when overlay channel is called after dispose. --- lib/src/controller/map/controller.dart | 2 +- lib/src/messaging/channel_wrapper.dart | 1 + lib/src/type/map/overlay/overlay/overlay_sender.dart | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/controller/map/controller.dart b/lib/src/controller/map/controller.dart index a532a256..0703c59b 100644 --- a/lib/src/controller/map/controller.dart +++ b/lib/src/controller/map/controller.dart @@ -268,8 +268,8 @@ class _NaverMapControllerImpl @override void dispose() { myLocationTracker._stopTracking(); - overlayController.disposeChannel(); _nowCameraPositionStreamController.close(); _trackingModeStreamController.close(); + overlayController.disposeChannel(); } } diff --git a/lib/src/messaging/channel_wrapper.dart b/lib/src/messaging/channel_wrapper.dart index 708144ca..4e3646e1 100644 --- a/lib/src/messaging/channel_wrapper.dart +++ b/lib/src/messaging/channel_wrapper.dart @@ -20,6 +20,7 @@ mixin NChannelWrapper { void disposeChannel() { if (isChannelInitialized) channel.setMethodCallHandler(null); + isChannelInitialized = false; } Future invokeMethod(String funcName, [NMessageable? arg]) { diff --git a/lib/src/type/map/overlay/overlay/overlay_sender.dart b/lib/src/type/map/overlay/overlay/overlay_sender.dart index b18408c9..39f1c287 100644 --- a/lib/src/type/map/overlay/overlay/overlay_sender.dart +++ b/lib/src/type/map/overlay/overlay/overlay_sender.dart @@ -21,6 +21,7 @@ mixin _NOverlaySender { dynamic lastValue; for (final overlayController in _overlayControllers) { + if (!overlayController.isChannelInitialized) continue; lastValue = await overlayController.invokeMethod(query, messageable); }