lineToMethodChannel static method

Map<String, dynamic> lineToMethodChannel(
  1. PrintStructure line
)

Implementation

static Map<String, dynamic> lineToMethodChannel(PrintStructure line) {
  if (line is TextPrint) {
    return {
      'type': 'text',
      'message': line.message,
      'alignment': _getAlignment(line.alignment),
      'fontSize': line.fontSize,
      'fontType': _getFontType(line.fontType),
      'bold': line.bold,
      'underline': line.underline,
      'italic': line.italic,
    };
  } else if (line is BarcodePrint) {
    return {
      'type': 'barcode',
      'message': line.message,
      'width': line.width,
      'height': line.height,
      'barcodeType': _getBarcodeType(line.barcodeType),
    };
  } else {
    throw Exception();
  }
}