disconnectPrinter method Null safety
- PrinterDevice device
override
断开连接
device
打印机设备
Implementation
@override
Future<bool?> disconnectPrinter(PrinterDevice device) async {
if (device is BluetoothDevice) {
return methodChannel.invokeMethod<bool>(
PluginConstants.methodDisconnectBluetoothPrinter,
device.toProto().writeToBuffer());
}
if (device is UsbDevice) {
return methodChannel.invokeMethod<bool>(
PluginConstants.methodDisconnectUsbPrinter,
device.toProto().writeToBuffer());
}
if (device is UsbAccessoryDevice) {
return methodChannel.invokeMethod<bool>(
PluginConstants.methodDisconnectUsbAccessoryPrinter,
device.toProto().writeToBuffer());
}
if (device is TtyDevice) {
return methodChannel.invokeMethod<bool>(
PluginConstants.methodDisconnectTtyPrinter,
device.toProto().writeToBuffer());
}
if (device is TcpDevice) {
return methodChannel.invokeMethod<bool>(
PluginConstants.methodDisconnectTcpPrinter,
device.toProto().writeToBuffer());
}
throw UnimplementedError();
}