disconnect method

Future<void> disconnect(
  1. Printer device
)

Disconnect from a printer device

Implementation

Future<void> disconnect(Printer device) async {
  if (device.connectionType == ConnectionType.BLE) {
    try {
      if (device.address != null) {
        await device.disconnect();
        log('Disconnected from device ${device.name}');
      }
    } catch (e) {
      log('Failed to disconnect device: $e');
    }
  }

  ///
  /// [printer] The printer device to print to.
  /// [bytes] The raw bytes to print.
  /// [longData] Whether the data is long and should be split into chunks.
  /// [chunkSize] The size of each chunk if [longData] is true.
  // USB devices don't need explicit disconnection
}