getUsbPrinters method

  1. @override
Future<List<PrinterDeviceInfo>> getUsbPrinters()
override

Implementation

@override
Future<List<PrinterDeviceInfo>> getUsbPrinters() async {
  try {
    final List<dynamic>? list =
        await methodChannel.invokeMethod<List<dynamic>>('getUsbPrinters');
    if (list == null) return const [];
    return list
        .map((e) =>
            PrinterDeviceInfo.fromMap(Map<String, dynamic>.from(e as Map)))
        .toList();
  } on PlatformException {
    return const [];
  } on MissingPluginException {
    return const [];
  }
}