encodePng method

Future<Uint8List> encodePng(
  1. BarcodeWriter writer,
  2. String data, {
  3. int? size,
  4. int? moduleSize,
})

Encodes data with writer and renders it as a PNG drawn with this style; see toPng. A QR code with a logo gets the logo's BarcodeLogo.neededErrorCorrection unless the writer sets its own, as in BarcodeView.

Throws BarcodeWriteException if data cannot be encoded.

Implementation

Future<Uint8List> encodePng(
  BarcodeWriter writer,
  String data, {
  int? size,
  int? moduleSize,
}) async =>
    toPng(await _encode(writer, data), size: size, moduleSize: moduleSize);