scanPrinters static method

Future<List<PrinterDevice>> scanPrinters(
  1. ConnectionType connectionType
)

Scan for all available printers of the specified connection type.

A convenience method that calls the appropriate scanning method based on the connection type.

  • connectionType: Type of connection to scan for

Returns a list of discovered printer devices.

Implementation

static Future<List<PrinterDevice>> scanPrinters(
    ConnectionType connectionType) async {
  switch (connectionType) {
    case ConnectionType.bluetooth:
    case ConnectionType.bluetoothLE:
      return scanBluetoothPrinters();
    case ConnectionType.ethernet:
    case ConnectionType.wifi:
    case ConnectionType.wifiDirect:
      return scanNetworkPrinters();
    case ConnectionType.usb:
      // USB scanning is typically handled differently
      // For now, we just return an empty list
      print('USB scanning not supported through this method');
      return [];
    default:
      return [];
  }
}