imprimir static method

Future imprimir({
  1. bool reimpresion = false,
  2. bool asistencia = true,
  3. required String texto,
})

Implementation

static Future imprimir({
  bool reimpresion = false,
  bool asistencia = true,
  required String texto,
}) async {
  var impresoras =
      await findPrinters(interfaces: [StarXpandInterface.bluetooth]);

  for (var i = 0; i < impresoras.length; i++) {
    var impresora1 = impresoras[i];

    try {
      var doc = StarXpandDocument();
      var printDoc = StarXpandDocumentPrint();

      printDoc.actionPrintLogo("000");

      printDoc.actionPrintText(texto);

      if (reimpresion) printDoc.actionPrintLogo("001");

      printDoc.actionFeed(10);
      if (asistencia) printDoc.actionPrintLogo("002");

      printDoc.actionCut(StarXpandCutType.partial);

      doc.addPrint(printDoc);
      doc.addDrawer(StarXpandDocumentDrawer());

      var result = await StarXpand.printDocument(impresora1, doc);

      return result;
    } catch (e) {
      print(e.toString());
    } finally {
      const Duration(seconds: 2);
    }
  }
}