openScale method

  1. @override
Future<int> openScale({
  1. String? path,
  2. int? index,
  3. String? address,
})
override

Open scale connection. Parameters depend on type:

  • serial: path (e.g. "/dev/ttyUSB0")
  • usb: index in device list
  • ble: address from device list Returns 0 on success, -4 if USB permission needed, or throws on failure.

Implementation

@override
Future<int> openScale({String? path, int? index, String? address}) async {
  final args = <String, Object?>{};
  if (path != null) args['path'] = path;
  if (index != null) args['index'] = index;
  if (address != null) args['address'] = address;
  args['connectionType'] = null; // platform uses init type
  final result = await methodChannel.invokeMethod<int>('openScale', args);
  return result ?? -1;
}