discovery method

Stream<PrinterDevice> discovery()

Implementation

Stream<PrinterDevice> discovery() async* {
  if (Platform.isAndroid) {
    final List<dynamic> results = await flutterPrinterChannel.invokeMethod('getList');
    for (final device in results) {
      var r = await device;
      yield PrinterDevice(
        name: r['product'],
        vendorId: r['vendorId'],
        productId: r['productId'],
        // name: r['name'],
      );
    }
  } else if (Platform.isWindows) {
    final List<dynamic> results = await flutterPrinterChannel.invokeMethod('getList');
    for (final device in results) {
      var r = await device;
      yield PrinterDevice(
        name: r['name'],
        // model: r['model'],
      );
    }
  }
}