dispose method
Dispose the scanner
Implementation
@override
Future<void> dispose() async {
try {
if (kDebugMode) {
debugPrint('QuickQR Scanner: Disposing scanner resources');
}
await methodChannel.invokeMethod('dispose');
// Clean up local resources
_scanSubscription?.cancel();
_scanSubscription = null;
_scanStream = null;
if (kDebugMode) {
debugPrint('QuickQR Scanner: Resources disposed successfully');
}
} on PlatformException catch (e) {
throw _handlePlatformException(e, 'dispose');
} catch (e) {
throw ScannerException(
ScannerErrorCode.internalError,
'Failed to dispose scanner: $e',
);
}
}