discoverPrinters static method

DiscoverResult<BluetoothPrinterDevice> discoverPrinters({
  1. bool isBle = false,
})

Implementation

static DiscoverResult<BluetoothPrinterDevice> discoverPrinters(
    {bool isBle = false}) async {
  if (Platform.isAndroid) {
    final List<dynamic> results = isBle
        ? await flutterPrinterChannel.invokeMethod('getBluetoothLeList')
        : await flutterPrinterChannel.invokeMethod('getBluetoothList');
    return results
        .map((dynamic r) => PrinterDiscovered<BluetoothPrinterDevice>(
              name: r['name'],
              detail: BluetoothPrinterDevice(
                address: r['address'],
              ),
            ))
        .toList();
  }
  return [];
}