d1_terminal_plugin

This plugin for D1 Terminal allows you to control the printer and LCD screen.

Platform Support

This plugin works only on android

Usage

To use this plugin, add d1_terminal_plugin as a dependency in your pubspec.yaml file

What this package do

  • x Print text with style
  • x Print qrcode (with style)
  • x Print barcode (with style)
  • x Jump n-lines
  • x Cut paper
  • x Get printer status
  • x Get printer cover status
  • x Open and close LCD screen
  • x Show text on LCD screen
  • x Show QR code on LCD screen
  • x Show Image on LCD screen (url, assets)
  • x Show scan QR code

Example

Import the library.

import 'package:d1_terminal_plugin/d1_terminal_plugin.dart';

Printer

D1TerminalPlugin.instance.printText(text: 'Sipari┼čim+');
D1TerminalPlugin.instance.printStart();
D1TerminalPlugin.instance.printBarCode(
  text: '120102012',
  symbology: D1BarcodeCodeSystem.CODABAR,
);
D1TerminalPlugin.instance.printStart();   
D1TerminalPlugin.instance.printQRCode(text: 'Sipari┼čim', size: 2, align: D1TextAlign.center);
D1TerminalPlugin.instance.printStart();

Cut Paper

D1TerminalPlugin.instance.cutPaper();

Get printer status

final result = await D1TerminalPlugin.instance.getPrinterStatus();

Get printer cover status

final result = await D1TerminalPlugin.instance.isPrinterCoverOpen();

Line feed

D1TerminalPlugin.instance.lineFeed(5);

LCD Screen

Show QR code on LCD screen

D1TerminalPlugin.instance.showText('Hello World', D1TextAlign.start);

Scan QR

D1TerminalPlugin.instance.showQRScan.call().then((value) {
  debugPrint('QR: $value');
  D1TerminalPlugin.instance.showText('QR: $value', D1TextAlign.center);
}).onError((error, stackTrace) {
  debugPrint(''Time Out'');
});

Open Screen

D1TerminalPlugin.instance.openScreen();

Close Screen

D1TerminalPlugin.instance.closeScreen();

Show QR Code on LCD screen

D1TerminalPlugin.instance.showQRCode('QR Code'),

Show Image asset on LCD screen

D1TerminalPlugin.instance.showImageAsset(imageAsset);

Show Image Network on LCD screen

D1TerminalPlugin.instance.showImageUrl(imageUrl);

NOTE

You must add support multidex ===> add support multidex