From 0af7f064ba4a2da987bf9a3f833dde29aa27e296 Mon Sep 17 00:00:00 2001 From: jack-szeto Date: Thu, 24 Oct 2024 21:21:13 +0800 Subject: [PATCH] Refactor dispose logic in PencilKit and PencilKitController --- lib/src/pencil_kit.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/pencil_kit.dart b/lib/src/pencil_kit.dart index 6706c09..7d62950 100644 --- a/lib/src/pencil_kit.dart +++ b/lib/src/pencil_kit.dart @@ -148,7 +148,7 @@ class _PencilKitState extends State { @override void dispose() { - _controller?._dispose(); // Dispose of the controller + _controller?.dispose(); // Dispose of the controller _controller = null; super.dispose(); } @@ -270,7 +270,7 @@ class PencilKitController { _channel.invokeMethod('loadBase64Data', base64Data); /// Dispose the controller and release resources - void _dispose() { + void dispose() { _channel.invokeMethod('dispose'); _channel.setMethodCallHandler(null); // Remove the method call handler }