# flutter_usb_printer_nullsafety **Repository Path**: CodeHeros/flutter_usb_printer_nullsafety ## Basic Information - **Project Name**: flutter_usb_printer_nullsafety - **Description**: No description available - **Primary Language**: Unknown - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-01 - **Last Updated**: 2021-09-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # flutter_usb_printer This plugin just migrate flutter_usb_printer to null safety, thanks to developer. 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> 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.'; } } ```