FLUTTER ECOSYSTEM

kechankrisna/flutter_usb_printer

kechankrisna/flutter_usb_printer open-source repository details.

flutter_usb_printer 專案封面
Stars
9
Forks
76
最近推送(UTC)
2026年8月18日
專案狀態
未封存
ke chankrisna GitHub avatar
GITHUB User

ke chankrisna ↗

Let share what we know 😄

MyLekha Tech SolutionsSiem reap官方網站 ↗
語言KotlinDart

此儲存庫發佈的套件

使用的依賴

依賴清單 3 項
  • flutter{"sdk":"flutter"}
  • flutter_test開發依賴{"sdk":"flutter"}
  • flutter_lints開發依賴^5.0.0

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

flutter_usb_printer

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

Getting Started

    flutter pub add flutter_usb_printer

Example of Usage

_getDevicelist() async {
    List<Map<String, dynamic>> results = [];
    results = await FlutterUsbPrinter.getUSBDeviceList();

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

_connect(int vendorId, int productId) async {
    bool returned;
    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);
      // await FlutterUsbPrinter.printRawData("text");
      // await FlutterUsbPrinter.printText("Testing ESC POS printer...");
    } on PlatformException {
      //response = 'Failed to get platform version.';
    }
}