toSvg method

  1. @nonVirtual
String toSvg(
  1. String data, {
  2. double x = 0,
  3. double y = 0,
  4. double width = 200,
  5. double height = 80,
  6. bool drawText = true,
  7. String fontFamily = 'monospace',
  8. double? fontHeight,
  9. double? textPadding,
  10. int color = 0x000000,
  11. bool fullSvg = true,
  12. double baseline = .75,
})

Create an SVG file with this Barcode from String data

Implementation

@nonVirtual
String toSvg(
  String data, {
  double x = 0,
  double y = 0,
  double width = 200,
  double height = 80,
  bool drawText = true,
  String fontFamily = 'monospace',
  double? fontHeight,
  double? textPadding,
  int color = 0x000000,
  bool fullSvg = true,
  double baseline = .75,
}) {
  fontHeight ??= height * 0.2;
  textPadding ??= height * 0.05;

  final recipe = make(
    data,
    width: width.toDouble(),
    height: height.toDouble(),
    drawText: drawText,
    fontHeight: fontHeight,
    textPadding: textPadding,
  );

  return _toSvg(recipe, x, y, width, height, fontFamily, fontHeight,
      textPadding, color, fullSvg, baseline);
}