scanTtyDevice method Null safety

  1. @override
Future<List<TtyDevice>?> scanTtyDevice()
override

扫描串口设备

Implementation

@override
Future<List<TtyDevice>?> scanTtyDevice() async {
  return methodChannel
      .invokeMethod(PluginConstants.methodScanTtyDevice)
      .then((value) {
    return proto.TtyDeviceList.fromBuffer(value)
        .items
        .map((e) => TtyDevice.fromProto(e))
        .toList();
  });
}