flutter_usb_printer 0.3.0+1
flutter_usb_printer: ^0.3.0+1 copied to clipboard
This plugin will allow develop send data and work with usb printer on android
0.3.0+1 #
Breaking Changes #
minSdkraised from 16 to 24
New Features #
- USB permission dialog is now shown automatically when a device is plugged in (via
USB_DEVICE_ATTACHEDintent-filter anddevice_filter.xml)
New Features #
isConnected(): New method that returnstrueonly when a device is selected, the USB connection is open, and the bulk-out endpoint is ready
Bug Fixes #
- Large print jobs:
write(),printText(), andprintRawText()now send data in 16 KB chunks instead of a single bulk transfer, eliminating JNI critical lock warnings on large payloads - Transfer retry: Bulk transfers are retried up to 3 times with increasing backoff (100ms/200ms/300ms) before failing
- Endpoint stall: A USB
CLEAR_FEATURE / ENDPOINT_HALTcontrol transfer is sent afterclaimInterfaceto clear any stale stall condition on the bulk-out endpoint, fixing-1transfer failures on first write after fresh connection - Power-cycle reconnect:
mUsbDeviceis now cleared onUSB_DEVICE_DETACHEDand whenopenDevice()fails, so power-cycling the printer no longer causes aRemoteException— the next write triggers a proper re-select and permission request with the fresh device reference - Permission flow:
connect()now waits for the user to respond to the USB permission dialog before resolving — previously it returnedtrueimmediately before the user even saw the dialog - Permission check:
hasPermission()is checked before callingrequestPermission()— no redundant dialog when permission is already granted - Connection reliability:
openConnection()now scans all USB interfaces (not just index 0) to find the BULK OUT endpoint, fixing printers that expose the print interface at index 1+ - Silent failure fixed:
openConnection()previously returnedtrueeven when no endpoint was found, causing a silent NPE onbulkTransfer; it now returnsfalsewith a clear log message - Transfer result:
write(),printText(), andprintRawText()now return the actual transfer result (b >= 0) instead of always returningtrue - Null crash: Fixed
NullPointerExceptionin the USB permission broadcast receiver whenEXTRA_DEVICEis absent on permission denial - UI null crash: Fixed crash in device list when
manufacturerorproductNamefields are null
Maintenance #
- Migrated Android build to AGP 8.11.1, Gradle 8.14, Kotlin 2.2.20
- Migrated to Kotlin DSL (
build.gradle.kts) and new Flutter Gradle plugin DSL - Fixed deprecated
getParcelableExtraAPI (Android 13+) - Fixed deprecated
buildDirsetter/getter (replaced withlayout.buildDirectory) - Replaced raw
Thread{}with Kotlin Coroutines for proper error propagation - Migrated test mocking to
TestDefaultBinaryMessengerBindingAPI - Added
flutter_lintsandanalysis_options.yaml - Added
android:exported="true"toMainActivity(required for Android 12+)
0.2.0 #
- Upgraded to Flutter 3.41.9 / Dart 3.9.2+
- Migrated Android build to AGP 8.11.1, Gradle 8.14, Kotlin 2.2.20
- Migrated to Kotlin DSL (build.gradle.kts) and new Flutter Gradle plugin DSL
- Raised minSdk from 16 to 24 (breaking change)
- Fixed deprecated getParcelableExtra API (Android 13+)
- Replaced raw Thread{} with Kotlin Coroutines for proper error propagation
- Fixed printText/printRawText always returning true regardless of actual result
- Fixed non-true singleton pattern in USBPrinterAdapter
- Migrated test mocking to TestDefaultBinaryMessengerBinding API
- Added flutter_lints and analysis_options.yaml
0.1.0+1 #
- fixed Future
0.1.0 #
- null safety
0.0.1 #
- first release