encode method
Encodes data with writer for this style: the symbol BarcodeView
shows. Under a logo a QR code gets the error correction the logo
needs (BarcodeLogo.neededErrorCorrection) unless the writer sets its
own, and a symbol large enough for it unless the writer sets a
version. Encode once, then draw with toPng and toSvg as often as
needed.
final style = BarcodeStyle(logo: BarcodeLogo(AssetImage('assets/logo.png')));
final symbol = await style.encode(const BarcodeWriter(BarcodeFormat.qrCode), wifi);
final png = await style.toPng(symbol, size: 1024);
Throws BarcodeWriteException if data cannot be encoded.
Implementation
Future<BarcodeSymbol> encode(BarcodeWriter writer, String data) =>
encodeUnderLogo(
writerUnderLogo(writer, logo),
logo?.size,
(BarcodeWriter w) => w.encode(data),
);