Skip to content

sglok/flutter_usb_thermal_plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flutter_usb_thermal_plugin

This plugin will allow develop send data and work with usb printer on android

Getting Started

    flutter pub add flutter_usb_thermal_plugin

Example of Usage

FlutterUsbThermalPlugin flutterUsbPrinter = FlutterUsbThermalPlugin();

....


_getDevicelist() async {
    List<UsbDevice> results = [];
    results = await flutterUsbPrinter.getUSBDeviceList();

    debugPrint(" length: ${results.length}");
    setState(() {
      devices = results;
    });
  }

_connect(int vendorId, int productId) async {
    bool? returned = false;
    try {
      returned = await flutterUsbPrinter.connect(vendorId, productId);
    } on PlatformException {
      //response = 'Failed to get platform version.';
    }
    if (returned!) {
      setState(() {
        connected = true;
      });
    }
  }

  _print() async {
    try {
      var data = Uint8List.fromList(
          utf8.encode(" Hello world Testing ESC POS printer..."));
      await flutterUsbPrinter.write(data);
    } on PlatformException {
      //response = 'Failed to get platform version.';
    }
  }

FAQ Support

Thanks For

About

Flutter Pakcage for USB Thermal Printer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published