connect method
Connect to a scanner by ID, or to the first available USB device if scannerId is null/empty.
scannerId The ID of the scanner to connect to, or null to auto-select the first available USB device.
Returns the connected scanner ID on success, or null if connection failed or no USB device was found.
Implementation
@override
Future<int?> connect(int? scannerId) async {
if (scannerId != null && scannerId <= 0) {
throw ArgumentError('scannerId must be null or greater than 0');
}
final result = await methodChannel.invokeMethod<int?>('connect', {
'scannerId': scannerId,
});
return result;
}