diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2e067c1..e56f416 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,21 @@
+## 1.0.11
+
+* fixed windows build
+
+## 1.0.8
+
+* android minSdkVersion to 21
+
+## 1.0.7
+
+* fixed iOS build
+* added some capabilities for printers
+
+## 1.0.6
+#### FORKED PROJECT
+* fixed Bt discovery issue with android 14 version
+* fix issue building android version
+
## 1.0.5
* fixed windows build
diff --git a/README.md b/README.md
index acaf1b4..8d6dfab 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
-# thermal_printer
+# thermal_printer_plus
+As the original [thermal_printer](https://pub.dev/packages/thermal_printer) has not received any update this one is meant to resolve issues by merging every solution contributed.
+I love this package, I work with this package but the maintenance of it is suffering from the OG, Any PR are welcome.
-[](https://pub.dev/packages/thermal_printer)
+[](https://pub.dev/packages/thermal_printer_plus)
A library to discover printers, and send printer commands.
@@ -57,8 +59,8 @@ In build.gradle set
```
defaultConfig {
...
- minSdkVersion 19
- targetSdkVersion 33
+ minSdkVersion 24
+ targetSdkVersion 34
...
```
@@ -87,6 +89,24 @@ put the following code in AndroidManifest
## iOS
Allow to connect bluetooth (BLE) and network devices
+Add in Info.plist
+```xml
+ NSBluetoothAlwaysUsageDescription
+ We need Bluetooth to connect to devices printer and print receipt.
+ NSBluetoothPeripheralUsageDescription
+ We need Bluetooth to connect and print receipt.
+```
+
+To discover network print don't forget to register dartPing at before runApp method
+
+```dart
+// Register DartPingIOS
+ if (Platform.isIOS) {
+ DartPingIOS.register();
+ }
+```
+
+
## Windows
Allow to connect USB and network devices
To network devices is necessary to set ipAddress
diff --git a/android/build.gradle b/android/build.gradle
index 909ce0a..35c7324 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -9,7 +9,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.4.0'
+ classpath 'com.android.tools.build:gradle:8.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
@@ -25,7 +25,8 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
- compileSdkVersion 33
+ namespace 'com.codingdevs.thermal_printer'
+ compileSdkVersion 35
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@@ -41,8 +42,8 @@ android {
}
defaultConfig {
- minSdkVersion 19
- targetSdkVersion 33
+ minSdkVersion 21
+ targetSdkVersion 35
}
}
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 2ec77e5..fce403e 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index e0ae8f2..500bb71 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -1,5 +1,4 @@
-
+
= Build.VERSION_CODES.S) {
- permissions.add(Manifest.permission.BLUETOOTH_SCAN)
- permissions.add(Manifest.permission.BLUETOOTH_CONNECT)
+ requiredPermissions.add(Manifest.permission.BLUETOOTH_SCAN)
+ requiredPermissions.add(Manifest.permission.BLUETOOTH_CONNECT)
+ } else {
+ requiredPermissions.add(Manifest.permission.BLUETOOTH)
+ requiredPermissions.add(Manifest.permission.BLUETOOTH_ADMIN)
+ }
+
+ // 1) If all permissions are already granted, return true.
+ if (hasPermissions(context, *requiredPermissions.toTypedArray())) {
+ return true
}
- if (!hasPermissions(context, *permissions.toTypedArray())) {
- ActivityCompat.requestPermissions(currentActivity!!, permissions.toTypedArray(), PERMISSION_ALL)
+ // 2) Identify which permissions we can request again
+ val permissionsToRequest = mutableListOf()
+ for (permission in requiredPermissions) {
+ val granted = ActivityCompat.checkSelfPermission(context!!, permission) == PackageManager.PERMISSION_GRANTED
+ val canAskAgain = ActivityCompat.shouldShowRequestPermissionRationale(currentActivity!!, permission)
+
+ if (!granted) {
+ // If not granted, check if we can still ask for it again
+ if (canAskAgain) {
+ // We'll add this permission to request
+ permissionsToRequest.add(permission)
+ } else {
+ // The user checked "Don't ask again" or the system policy prohibits asking
+ Toast.makeText(context, "Permission is permanently denied. Please enable it in Settings.", Toast.LENGTH_LONG).show()
+ return false
+ }
+ }
+ }
+
+ // 3) If there's no permission left to request, it means everything's either granted or permanently denied
+ if (permissionsToRequest.isEmpty()) {
return false
}
- return true
+
+ // 4) Request all the missing permissions
+ ActivityCompat.requestPermissions(currentActivity!!, permissionsToRequest.toTypedArray(), PERMISSION_ALL)
+ return false
}
private fun hasPermissions(context: Context?, vararg permissions: String?): Boolean {
diff --git a/android/src/main/kotlin/com/codingdevs/thermal_printer/adapter/USBPrinterAdapter.kt b/android/src/main/kotlin/com/codingdevs/thermal_printer/adapter/USBPrinterAdapter.kt
index dc93fb5..8b0333b 100644
--- a/android/src/main/kotlin/com/codingdevs/thermal_printer/adapter/USBPrinterAdapter.kt
+++ b/android/src/main/kotlin/com/codingdevs/thermal_printer/adapter/USBPrinterAdapter.kt
@@ -27,14 +27,20 @@ class USBPrinterAdapter private constructor() {
fun init(reactContext: Context?) {
mContext = reactContext
mUSBManager = mContext!!.getSystemService(Context.USB_SERVICE) as UsbManager
+ val explicitIntent = Intent(ACTION_USB_PERMISSION);
+ explicitIntent.setPackage(mContext?.packageName);
mPermissionIndent = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
- PendingIntent.getBroadcast(mContext, 0, Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_MUTABLE)
+ PendingIntent.getBroadcast(mContext, 0, explicitIntent, PendingIntent.FLAG_MUTABLE)
} else {
- PendingIntent.getBroadcast(mContext, 0, Intent(ACTION_USB_PERMISSION), 0)
+ PendingIntent.getBroadcast(mContext, 0, explicitIntent, 0)
}
val filter = IntentFilter(ACTION_USB_PERMISSION)
filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED)
- mContext!!.registerReceiver(mUsbDeviceReceiver, filter)
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) {
+ mContext!!.registerReceiver(mUsbDeviceReceiver, filter, Context.RECEIVER_NOT_EXPORTED);
+ } else {
+ mContext!!.registerReceiver(mUsbDeviceReceiver, filter);
+ }
Log.v(LOG_TAG, "ESC/POS Printer initialized")
}
diff --git a/android/src/main/kotlin/com/codingdevs/thermal_printer/usb/USBPrinterService.kt b/android/src/main/kotlin/com/codingdevs/thermal_printer/usb/USBPrinterService.kt
index a9c3499..9d79ae5 100644
--- a/android/src/main/kotlin/com/codingdevs/thermal_printer/usb/USBPrinterService.kt
+++ b/android/src/main/kotlin/com/codingdevs/thermal_printer/usb/USBPrinterService.kt
@@ -70,14 +70,20 @@ class USBPrinterService private constructor(private var mHandler: Handler?) {
fun init(reactContext: Context?) {
mContext = reactContext
mUSBManager = mContext!!.getSystemService(Context.USB_SERVICE) as UsbManager
+ val explicitIntent = Intent(ACTION_USB_PERMISSION);
+ explicitIntent.setPackage(mContext?.packageName);
mPermissionIndent = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
- PendingIntent.getBroadcast(mContext, 0, Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_MUTABLE)
+ PendingIntent.getBroadcast(mContext, 0, explicitIntent, PendingIntent.FLAG_MUTABLE)
} else {
- PendingIntent.getBroadcast(mContext, 0, Intent(ACTION_USB_PERMISSION), 0)
+ PendingIntent.getBroadcast(mContext, 0, explicitIntent, 0)
}
val filter = IntentFilter(ACTION_USB_PERMISSION)
filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED)
- mContext!!.registerReceiver(mUsbDeviceReceiver, filter)
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) {
+ mContext!!.registerReceiver(mUsbDeviceReceiver, filter, Context.RECEIVER_NOT_EXPORTED);
+ } else {
+ mContext!!.registerReceiver(mUsbDeviceReceiver, filter);
+ }
Log.v(LOG_TAG, "ESC/POS Printer initialized")
}
diff --git a/android/src/main/kotlin/com/codingdevs/thermal_printer/usb/UsbReceiver.kt b/android/src/main/kotlin/com/codingdevs/thermal_printer/usb/UsbReceiver.kt
index e1faf75..0d538f1 100644
--- a/android/src/main/kotlin/com/codingdevs/thermal_printer/usb/UsbReceiver.kt
+++ b/android/src/main/kotlin/com/codingdevs/thermal_printer/usb/UsbReceiver.kt
@@ -16,11 +16,12 @@ class UsbReceiver : BroadcastReceiver() {
if (UsbManager.ACTION_USB_DEVICE_ATTACHED == action) {
val usbDevice: UsbDevice? = intent.getParcelableExtra(UsbManager.EXTRA_DEVICE)
-
+ val explicitIntent = Intent("com.flutter_pos_printer.USB_PERMISSION");
+ explicitIntent.setPackage(context?.packageName);
val mPermissionIndent = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) {
- PendingIntent.getBroadcast(context, 0, Intent("com.flutter_pos_printer.USB_PERMISSION"), PendingIntent.FLAG_MUTABLE)
+ PendingIntent.getBroadcast(context, 0, explicitIntent, PendingIntent.FLAG_MUTABLE)
} else {
- PendingIntent.getBroadcast(context, 0, Intent("com.flutter_pos_printer.USB_PERMISSION"), 0)
+ PendingIntent.getBroadcast(context, 0, explicitIntent, 0)
}
val mUSBManager = context?.getSystemService(Context.USB_SERVICE) as UsbManager?
mUSBManager?.requestPermission(usbDevice, mPermissionIndent)
diff --git a/assets/resources/capabilities.json b/assets/resources/capabilities.json
index 1a9ec0d..4ebf8b6 100644
--- a/assets/resources/capabilities.json
+++ b/assets/resources/capabilities.json
@@ -69,7 +69,6 @@
"model": "Default",
"description": "Default ESC/POS profile"
},
-
"XP-N160I": {
"codePages": {
"0": "CP437",
@@ -144,7 +143,6 @@
"model": "XP-N160I",
"description": ""
},
-
"RP80USE": {
"codePages": {
"0": "CP437",
@@ -195,7 +193,6 @@
"model": "RP80USE",
"description": ""
},
-
"TP806L": {
"codePages": {
"0": "PC437",
@@ -221,5 +218,256 @@
"model": "TP806L",
"description": ""
}
+ },
+ "Star_TSP100": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP932",
+ "2": "CP850",
+ "3": "CP860",
+ "4": "CP863",
+ "5": "CP865",
+ "6": "CP1252",
+ "7": "CP866",
+ "8": "CP852",
+ "9": "CP858",
+ "10": "CP874",
+ "11": "ISO_8859-1",
+ "12": "ISO_8859-2",
+ "13": "ISO_8859-3",
+ "14": "ISO_8859-4",
+ "15": "ISO_8859-5",
+ "16": "ISO_8859-6",
+ "17": "ISO_8859-7",
+ "18": "ISO_8859-8",
+ "19": "ISO_8859-9",
+ "20": "ISO_8859-10",
+ "21": "ISO_8859-11",
+ "22": "ISO_8859-12",
+ "23": "ISO_8859-13",
+ "24": "ISO_8859-14",
+ "25": "ISO_8859-15",
+ "26": "ISO_8859-16",
+ "27": "CP1250",
+ "28": "CP1251",
+ "29": "CP1253",
+ "30": "CP1254",
+ "31": "CP1255",
+ "32": "CP1256",
+ "33": "CP1257",
+ "34": "CP1258",
+ "35": "CP866"
+ },
+ "vendor": "Star Micronics",
+ "model": "TSP100",
+ "description": "Star TSP100 ESC/POS thermal receipt printer"
+ },
+ "T1N": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP932",
+ "6": "CP1252",
+ "7": "CP866",
+ "8": "CP852",
+ "9": "CP858",
+ "10": "CP864",
+ "11": "CP775",
+ "12": "CP1250",
+ "13": "CP1251",
+ "14": "CP1253",
+ "15": "CP1254",
+ "16": "CP1255",
+ "17": "CP1256",
+ "18": "CP1257",
+ "19": "CP1258",
+ "20": "ISO_8859-1",
+ "21": "ISO_8859-2",
+ "22": "ISO_8859-3",
+ "23": "ISO_8859-4",
+ "24": "ISO_8859-5",
+ "25": "ISO_8859-6",
+ "26": "ISO_8859-7",
+ "27": "ISO_8859-8",
+ "28": "ISO_8859-9",
+ "29": "ISO_8859-15",
+ "30": "Unknown",
+ "31": "Unknown",
+ "32": "Unknown",
+ "255": "Unknown"
+ },
+ "vendor": "T1N",
+ "model": "Virtual Bluetooth Thermal Printer",
+ "description": "T1N Virtual Bluetooth Thermal Printer profile for ESC/POS commands"
+ },
+ "Epson_TM-T88V": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP932",
+ "2": "CP850",
+ "3": "CP860",
+ "4": "CP863",
+ "5": "CP865",
+ "6": "CP1252",
+ "7": "CP866",
+ "8": "CP852",
+ "9": "CP858",
+ "10": "CP874"
+ },
+ "vendor": "Epson",
+ "model": "TM-T88V",
+ "description": "High-performance thermal receipt printer for retail and hospitality."
+ },
+ "Bixolon_SRP-350III": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858",
+ "9": "CP874"
+ },
+ "vendor": "Bixolon",
+ "model": "SRP-350III",
+ "description": "Reliable and versatile thermal printer for POS environments."
+ },
+ "Zebra_ZQ510": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858"
+ },
+ "vendor": "Zebra",
+ "model": "ZQ510",
+ "description": "Rugged mobile printer ideal for field service and logistics."
+ },
+ "Star_TSP654II": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP932",
+ "2": "CP850",
+ "3": "CP860",
+ "4": "CP863",
+ "5": "CP865",
+ "6": "CP1252",
+ "7": "CP866",
+ "8": "CP852",
+ "9": "CP858"
+ },
+ "vendor": "Star Micronics",
+ "model": "TSP654II",
+ "description": "Compact and fast thermal printer for retail and hospitality."
+ },
+ "Citizen_CT-S310II": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858",
+ "9": "CP874"
+ },
+ "vendor": "Citizen",
+ "model": "CT-S310II",
+ "description": "Eco-friendly thermal printer with high-speed printing."
+ },
+ "POS-X_EVO_HiSpeed": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858",
+ "9": "CP874"
+ },
+ "vendor": "POS-X",
+ "model": "EVO HiSpeed",
+ "description": "High-speed thermal receipt printer for POS applications."
+ },
+ "Toshiba_B-FV4D": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858"
+ },
+ "vendor": "Toshiba",
+ "model": "B-FV4D",
+ "description": "Compact desktop printer for retail and healthcare."
+ },
+ "Sewoo_LK-P24": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858"
+ },
+ "vendor": "Sewoo",
+ "model": "LK-P24",
+ "description": "Portable thermal printer for mobile point-of-sale."
+ },
+ "NCR_RealPOS_7198": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858",
+ "9": "CP874"
+ },
+ "vendor": "NCR",
+ "model": "RealPOS 7198",
+ "description": "High-speed thermal printer for retail environments."
+ },
+ "Honeywell_PC42t": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858"
+ },
+ "vendor": "Honeywell",
+ "model": "PC42t",
+ "description": "Versatile desktop label printer for retail and manufacturing."
}
}
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index 6cd1658..ecd8045 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -1,3 +1,9 @@
+plugins {
+ id "com.android.application"
+ id "kotlin-android"
+ id "dev.flutter.flutter-gradle-plugin"
+}
+
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
}
}
-def flutterRoot = localProperties.getProperty('flutter.sdk')
-if (flutterRoot == null) {
- throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
-}
-
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
@@ -21,12 +22,9 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
-apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
-apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
-
android {
- compileSdkVersion flutter.compileSdkVersion
+ namespace 'com.codingdevs.thermal_printer_example'
+ compileSdkVersion 35
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@@ -44,8 +42,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.codingdevs.thermal_printer_example"
- minSdkVersion 19
- targetSdkVersion 33
+ minSdkVersion 24
+ targetSdkVersion 35
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
@@ -64,5 +62,4 @@ flutter {
}
dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
diff --git a/example/android/build.gradle b/example/android/build.gradle
index 92546c1..bc157bd 100644
--- a/example/android/build.gradle
+++ b/example/android/build.gradle
@@ -1,16 +1,3 @@
-buildscript {
- ext.kotlin_version = '1.9.10'
- repositories {
- google()
- mavenCentral()
- }
-
- dependencies {
- classpath 'com.android.tools.build:gradle:7.4.0'
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- }
-}
-
allprojects {
repositories {
google()
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties
index 6b66533..fb5eb59 100644
--- a/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
diff --git a/example/android/settings.gradle b/example/android/settings.gradle
index 44e62bc..32c78c5 100644
--- a/example/android/settings.gradle
+++ b/example/android/settings.gradle
@@ -1,11 +1,26 @@
-include ':app'
+pluginManagement {
+ def flutterSdkPath = {
+ def properties = new Properties()
+ file("local.properties").withInputStream { properties.load(it) }
+ def flutterSdkPath = properties.getProperty("flutter.sdk")
+ assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
+ return flutterSdkPath
+ }()
-def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
-def properties = new Properties()
+ includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
-assert localPropertiesFile.exists()
-localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
-def flutterSdkPath = properties.getProperty("flutter.sdk")
-assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
-apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
+plugins {
+ id "dev.flutter.flutter-plugin-loader" version "1.0.0"
+ id "com.android.application" version "8.3.0" apply false
+ id "org.jetbrains.kotlin.android" version "1.9.10" apply false
+}
+
+
+include ':app'
\ No newline at end of file
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist
index 8d4492f..1dc6cf7 100644
--- a/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/example/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 9.0
+ 13.0
diff --git a/example/ios/Podfile b/example/ios/Podfile
index 1e8c3c9..10f3c9b 100644
--- a/example/ios/Podfile
+++ b/example/ios/Podfile
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
-# platform :ios, '9.0'
+platform :ios, '13.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock
index fcaf980..977759e 100644
--- a/example/ios/Podfile.lock
+++ b/example/ios/Podfile.lock
@@ -1,34 +1,34 @@
PODS:
- Flutter (1.0.0)
- - thermal_printer (0.0.1):
- - Flutter
- - flutter_star_prnt (0.0.1):
+ - flutter_icmp_ping (0.0.1):
- Flutter
- network_info_plus (0.0.1):
- Flutter
+ - thermal_printer_plus (1.0.11):
+ - Flutter
DEPENDENCIES:
- Flutter (from `Flutter`)
- - thermal_printer (from `.symlinks/plugins/thermal_printer/ios`)
- - flutter_star_prnt (from `.symlinks/plugins/flutter_star_prnt/ios`)
+ - flutter_icmp_ping (from `.symlinks/plugins/flutter_icmp_ping/ios`)
- network_info_plus (from `.symlinks/plugins/network_info_plus/ios`)
+ - thermal_printer_plus (from `.symlinks/plugins/thermal_printer_plus/ios`)
EXTERNAL SOURCES:
Flutter:
:path: Flutter
- thermal_printer:
- :path: ".symlinks/plugins/thermal_printer/ios"
- flutter_star_prnt:
- :path: ".symlinks/plugins/flutter_star_prnt/ios"
+ flutter_icmp_ping:
+ :path: ".symlinks/plugins/flutter_icmp_ping/ios"
network_info_plus:
:path: ".symlinks/plugins/network_info_plus/ios"
+ thermal_printer_plus:
+ :path: ".symlinks/plugins/thermal_printer_plus/ios"
SPEC CHECKSUMS:
- Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
- thermal_printer: 72176df8340825c736b5768fce1591e8884e456e
- flutter_star_prnt: c4ea89b6b9ccb708624f5830c9d34b7ee1165999
- network_info_plus: b78876159360f5580608c2cea620d6ceffabd0ad
+ Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
+ flutter_icmp_ping: 47c1df3440c18ddd39fc457e607bb3b42d4a339f
+ network_info_plus: cf61925ab5205dce05a4f0895989afdb6aade5fc
+ thermal_printer_plus: ad9ed77574c9da74de2d4fc89f1f773e52c41a0f
-PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
+PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b
-COCOAPODS: 1.11.3
+COCOAPODS: 1.16.2
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 7360c87..f194241 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 50;
+ objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -68,7 +68,6 @@
E0E3FD80E0B79A8ABC11BBC1 /* Pods-Runner.release.xcconfig */,
1C58FBFFA0E12ED58F12B1CB /* Pods-Runner.profile.xcconfig */,
);
- name = Pods;
path = Pods;
sourceTree = "";
};
@@ -156,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 1300;
+ LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@@ -200,10 +199,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
+ "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
@@ -236,6 +237,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
+ alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -340,7 +342,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -356,6 +358,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = XSQ379TX3B;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@@ -417,7 +420,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -466,7 +469,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
@@ -484,6 +487,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = XSQ379TX3B;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
@@ -506,6 +510,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = XSQ379TX3B;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index c87d15a..9c12df5 100644
--- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -1,6 +1,6 @@
diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift
index 70693e4..b636303 100644
--- a/example/ios/Runner/AppDelegate.swift
+++ b/example/ios/Runner/AppDelegate.swift
@@ -1,7 +1,7 @@
import UIKit
import Flutter
-@UIApplicationMain
+@main
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist
index bb75142..9bd96d6 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -2,6 +2,8 @@
+ CADisableMinimumFrameDurationOnPhone
+
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
@@ -24,6 +26,13 @@
$(FLUTTER_BUILD_NUMBER)
LSRequiresIPhoneOS
+ UIApplicationSupportsIndirectInputEvents
+
+ UIBackgroundModes
+
+ bluetooth-central
+ fetch
+
UILaunchStoryboardName
LaunchScreen
UIMainStoryboardFile
@@ -43,7 +52,9 @@
UIViewControllerBasedStatusBarAppearance
- CADisableMinimumFrameDurationOnPhone
-
+ NSBluetoothAlwaysUsageDescription
+ We need Bluetooth to connect to devices.
+ NSBluetoothPeripheralUsageDescription
+ We need Bluetooth to connect to peripherals.
diff --git a/example/lib/main.dart b/example/lib/main.dart
index f40a1a3..3ccb907 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -3,8 +3,8 @@ import 'dart:developer';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-import 'package:thermal_printer/esc_pos_utils_platform/esc_pos_utils_platform.dart';
-import 'package:thermal_printer/thermal_printer.dart';
+import 'package:thermal_printer_plus/esc_pos_utils_platform/esc_pos_utils_platform.dart';
+import 'package:thermal_printer_plus/thermal_printer.dart';
import 'package:image/image.dart' as img;
import 'package:dart_ping_ios/dart_ping_ios.dart';
import 'image_utils.dart';
@@ -302,7 +302,7 @@ class _MyAppState extends State {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
- title: const Text('Flutter Pos Plugin Platform example app'),
+ title: const Text('Thermal Printer Plus example app'),
),
body: Center(
child: Container(
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 17e411f..73b19b3 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -6,7 +6,7 @@ description: Demonstrates how to use the thermal_printer plugin.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
environment:
- sdk: '>=2.18.4 <3.3.10'
+ sdk: '>=3.4.1 <4.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
@@ -18,7 +18,7 @@ dependencies:
flutter:
sdk: flutter
- thermal_printer:
+ thermal_printer_plus:
# When depending on this package from a real application you should use:
# thermal_printer: ^x.y.z
# See https://dart.dev/tools/pub/dependencies#version-constraints
diff --git a/example/windows/flutter/generated_plugin_registrant.cc b/example/windows/flutter/generated_plugin_registrant.cc
index 5840272..f66dff6 100644
--- a/example/windows/flutter/generated_plugin_registrant.cc
+++ b/example/windows/flutter/generated_plugin_registrant.cc
@@ -6,7 +6,7 @@
#include "generated_plugin_registrant.h"
-#include
+#include
void RegisterPlugins(flutter::PluginRegistry* registry) {
ThermalPrinterPluginRegisterWithRegistrar(
diff --git a/example/windows/flutter/generated_plugins.cmake b/example/windows/flutter/generated_plugins.cmake
index 3454c74..9960d99 100644
--- a/example/windows/flutter/generated_plugins.cmake
+++ b/example/windows/flutter/generated_plugins.cmake
@@ -3,7 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
- thermal_printer
+ thermal_printer_plus
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
diff --git a/ios/Classes/ConnecterManager.m b/ios/Classes/ConnecterManager.m
index d50e31b..fc6a072 100644
--- a/ios/Classes/ConnecterManager.m
+++ b/ios/Classes/ConnecterManager.m
@@ -30,6 +30,12 @@ +(instancetype)sharedInstance {
* @param discover 发现的设备
*/
-(void)scanForPeripheralsWithServices:(nullable NSArray *)serviceUUIDs options:(nullable NSDictionary *)options discover:(void(^_Nullable)(CBPeripheral *_Nullable peripheral,NSDictionary *_Nullable advertisementData,NSNumber *_Nullable RSSI))discover{
+ // Ensure BLEConnecter exists - recreate only if it was never created
+ // (we don't deallocate it on disconnect to prevent delegate crashes)
+ if (_bleConnecter == nil) {
+ currentConnMethod = BLUETOOTH;
+ [self initConnecter:currentConnMethod];
+ }
[_bleConnecter scanForPeripheralsWithServices:serviceUUIDs options:options discover:discover];
}
@@ -60,13 +66,27 @@ -(void)initConnecter:(ConnectMethod)connectMethod {
* 方法说明:停止扫描
*/
-(void)stopScan {
- [_bleConnecter stopScan];
+ if (_bleConnecter != nil) {
+ [_bleConnecter stopScan];
+ }
}
/**
* 连接
*/
-(void)connectPeripheral:(CBPeripheral *)peripheral options:(nullable NSDictionary *)options timeout:(NSUInteger)timeout connectBlack:(void(^_Nullable)(ConnectState state)) connectState{
+ // Ensure BLEConnecter exists - recreate only if it was never created
+ // (we don't deallocate it on disconnect to prevent delegate crashes)
+ if (_bleConnecter == nil) {
+ currentConnMethod = BLUETOOTH;
+ [self initConnecter:currentConnMethod];
+ }
+
+ // If there's an existing connection, disconnect it first
+ if (_bleConnecter.connPeripheral != nil && _bleConnecter.connPeripheral != peripheral) {
+ [_bleConnecter closePeripheral:_bleConnecter.connPeripheral];
+ }
+
[_bleConnecter connectPeripheral:peripheral options:options timeout:timeout connectBlack:connectState];
}
@@ -90,19 +110,39 @@ -(void)write:(NSData *)data {
#ifdef DEBUG
NSLog(@"[ConnecterManager] write:");
#endif
+
+ // Guard: Check if characteristic exists before writing
+ if (_bleConnecter != nil && _bleConnecter.transparentDataWriteChar == nil) {
+ NSLog(@"[ConnecterManager] ERROR: Cannot write - transparentDataWriteChar is nil. Characteristics may not be discovered yet.");
+ return; // Prevent crash by returning early
+ }
+
_bleConnecter.writeProgress = nil;
[_connecter write:data];
}
-(void)close {
+ // Stop scanning first to prevent new delegate callbacks
+ if (_bleConnecter != nil) {
+ [_bleConnecter stopScan];
+ }
+
+ // Properly disconnect the peripheral if connected
+ if (_bleConnecter != nil && _bleConnecter.connPeripheral != nil) {
+ [_bleConnecter closePeripheral:_bleConnecter.connPeripheral];
+ }
+
+ // Close the connecter (this should handle delegate cleanup)
if (_connecter) {
[_connecter close];
}
- switch (currentConnMethod) {
- case BLUETOOTH:
- _bleConnecter = nil;
- break;
- }
+
+ // IMPORTANT: Do NOT set _bleConnecter = nil here!
+ // Core Bluetooth retains a reference to BLEConnecter as a delegate,
+ // and can call delegate methods (like centralManagerDidUpdateState:) at any time.
+ // If we deallocate BLEConnecter, Core Bluetooth will crash when trying to call these methods.
+ // Instead, keep BLEConnecter alive - it can be reused for new connections.
+ // The BLEConnecter will handle being disconnected and can accept new connections.
}
@end
diff --git a/ios/Classes/ThermalPrinterPlugin.m b/ios/Classes/ThermalPrinterPlugin.m
index abe96d7..d32831a 100644
--- a/ios/Classes/ThermalPrinterPlugin.m
+++ b/ios/Classes/ThermalPrinterPlugin.m
@@ -111,6 +111,14 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
}
NSData *data2 = [NSData dataWithBytes:cArray length:sizeof(cArray)];
// NSLog(@"bytes in hex: %@", [data2 description]);
+
+ // Guard: Check if characteristic exists before writing
+ if (Manager.bleConnecter != nil && Manager.bleConnecter.transparentDataWriteChar == nil) {
+ NSLog(@"[ThermalPrinterPlugin] ERROR: Cannot write - transparentDataWriteChar is nil. Characteristics may not be discovered yet.");
+ result(nil);
+ return; // Prevent crash by returning early
+ }
+
[Manager write:data2];
result(nil);
} @catch(FlutterError *e) {
diff --git a/ios/thermal_printer.podspec b/ios/thermal_printer_plus.podspec
similarity index 90%
rename from ios/thermal_printer.podspec
rename to ios/thermal_printer_plus.podspec
index d4bee84..086fcbf 100644
--- a/ios/thermal_printer.podspec
+++ b/ios/thermal_printer_plus.podspec
@@ -3,8 +3,8 @@
# Run `pod lib lint thermal_printer.podspec` to validate before publishing.
#
Pod::Spec.new do |s|
- s.name = 'thermal_printer'
- s.version = '1.0.0'
+ s.name = 'thermal_printer_plus'
+ s.version = '1.0.11'
s.summary = 'A new Flutter plugin project.'
s.description = <<-DESC
A new Flutter plugin project.
@@ -17,7 +17,7 @@ A new Flutter plugin project.
s.public_header_files = 'Classes/**/*.h'
s.static_framework = true
s.dependency 'Flutter'
- s.platform = :ios, '9.0'
+ s.platform = :ios, '12.0'
# Import all * .a libraries in the Classes folder
s.frameworks = ["SystemConfiguration", "CoreTelephony","WebKit"]
diff --git a/lib/esc_pos_utils_platform/src/capability_profile.dart b/lib/esc_pos_utils_platform/src/capability_profile.dart
index 68a75e8..4ffb595 100644
--- a/lib/esc_pos_utils_platform/src/capability_profile.dart
+++ b/lib/esc_pos_utils_platform/src/capability_profile.dart
@@ -20,7 +20,7 @@ class CapabilityProfile {
/// Public factory
static Future load({String name = 'default'}) async {
- final content = await rootBundle.loadString('packages/thermal_printer/resources/capabilities.json');
+ final content = await rootBundle.loadString('packages/thermal_printer_plus/resources/capabilities.json');
Map capabilities = json.decode(content);
var profile = capabilities['profiles'][name];
diff --git a/lib/resources/capabilities.json b/lib/resources/capabilities.json
index 1a9ec0d..4ebf8b6 100644
--- a/lib/resources/capabilities.json
+++ b/lib/resources/capabilities.json
@@ -69,7 +69,6 @@
"model": "Default",
"description": "Default ESC/POS profile"
},
-
"XP-N160I": {
"codePages": {
"0": "CP437",
@@ -144,7 +143,6 @@
"model": "XP-N160I",
"description": ""
},
-
"RP80USE": {
"codePages": {
"0": "CP437",
@@ -195,7 +193,6 @@
"model": "RP80USE",
"description": ""
},
-
"TP806L": {
"codePages": {
"0": "PC437",
@@ -221,5 +218,256 @@
"model": "TP806L",
"description": ""
}
+ },
+ "Star_TSP100": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP932",
+ "2": "CP850",
+ "3": "CP860",
+ "4": "CP863",
+ "5": "CP865",
+ "6": "CP1252",
+ "7": "CP866",
+ "8": "CP852",
+ "9": "CP858",
+ "10": "CP874",
+ "11": "ISO_8859-1",
+ "12": "ISO_8859-2",
+ "13": "ISO_8859-3",
+ "14": "ISO_8859-4",
+ "15": "ISO_8859-5",
+ "16": "ISO_8859-6",
+ "17": "ISO_8859-7",
+ "18": "ISO_8859-8",
+ "19": "ISO_8859-9",
+ "20": "ISO_8859-10",
+ "21": "ISO_8859-11",
+ "22": "ISO_8859-12",
+ "23": "ISO_8859-13",
+ "24": "ISO_8859-14",
+ "25": "ISO_8859-15",
+ "26": "ISO_8859-16",
+ "27": "CP1250",
+ "28": "CP1251",
+ "29": "CP1253",
+ "30": "CP1254",
+ "31": "CP1255",
+ "32": "CP1256",
+ "33": "CP1257",
+ "34": "CP1258",
+ "35": "CP866"
+ },
+ "vendor": "Star Micronics",
+ "model": "TSP100",
+ "description": "Star TSP100 ESC/POS thermal receipt printer"
+ },
+ "T1N": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP932",
+ "6": "CP1252",
+ "7": "CP866",
+ "8": "CP852",
+ "9": "CP858",
+ "10": "CP864",
+ "11": "CP775",
+ "12": "CP1250",
+ "13": "CP1251",
+ "14": "CP1253",
+ "15": "CP1254",
+ "16": "CP1255",
+ "17": "CP1256",
+ "18": "CP1257",
+ "19": "CP1258",
+ "20": "ISO_8859-1",
+ "21": "ISO_8859-2",
+ "22": "ISO_8859-3",
+ "23": "ISO_8859-4",
+ "24": "ISO_8859-5",
+ "25": "ISO_8859-6",
+ "26": "ISO_8859-7",
+ "27": "ISO_8859-8",
+ "28": "ISO_8859-9",
+ "29": "ISO_8859-15",
+ "30": "Unknown",
+ "31": "Unknown",
+ "32": "Unknown",
+ "255": "Unknown"
+ },
+ "vendor": "T1N",
+ "model": "Virtual Bluetooth Thermal Printer",
+ "description": "T1N Virtual Bluetooth Thermal Printer profile for ESC/POS commands"
+ },
+ "Epson_TM-T88V": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP932",
+ "2": "CP850",
+ "3": "CP860",
+ "4": "CP863",
+ "5": "CP865",
+ "6": "CP1252",
+ "7": "CP866",
+ "8": "CP852",
+ "9": "CP858",
+ "10": "CP874"
+ },
+ "vendor": "Epson",
+ "model": "TM-T88V",
+ "description": "High-performance thermal receipt printer for retail and hospitality."
+ },
+ "Bixolon_SRP-350III": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858",
+ "9": "CP874"
+ },
+ "vendor": "Bixolon",
+ "model": "SRP-350III",
+ "description": "Reliable and versatile thermal printer for POS environments."
+ },
+ "Zebra_ZQ510": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858"
+ },
+ "vendor": "Zebra",
+ "model": "ZQ510",
+ "description": "Rugged mobile printer ideal for field service and logistics."
+ },
+ "Star_TSP654II": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP932",
+ "2": "CP850",
+ "3": "CP860",
+ "4": "CP863",
+ "5": "CP865",
+ "6": "CP1252",
+ "7": "CP866",
+ "8": "CP852",
+ "9": "CP858"
+ },
+ "vendor": "Star Micronics",
+ "model": "TSP654II",
+ "description": "Compact and fast thermal printer for retail and hospitality."
+ },
+ "Citizen_CT-S310II": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858",
+ "9": "CP874"
+ },
+ "vendor": "Citizen",
+ "model": "CT-S310II",
+ "description": "Eco-friendly thermal printer with high-speed printing."
+ },
+ "POS-X_EVO_HiSpeed": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858",
+ "9": "CP874"
+ },
+ "vendor": "POS-X",
+ "model": "EVO HiSpeed",
+ "description": "High-speed thermal receipt printer for POS applications."
+ },
+ "Toshiba_B-FV4D": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858"
+ },
+ "vendor": "Toshiba",
+ "model": "B-FV4D",
+ "description": "Compact desktop printer for retail and healthcare."
+ },
+ "Sewoo_LK-P24": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858"
+ },
+ "vendor": "Sewoo",
+ "model": "LK-P24",
+ "description": "Portable thermal printer for mobile point-of-sale."
+ },
+ "NCR_RealPOS_7198": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858",
+ "9": "CP874"
+ },
+ "vendor": "NCR",
+ "model": "RealPOS 7198",
+ "description": "High-speed thermal printer for retail environments."
+ },
+ "Honeywell_PC42t": {
+ "codePages": {
+ "0": "CP437",
+ "1": "CP850",
+ "2": "CP860",
+ "3": "CP863",
+ "4": "CP865",
+ "5": "CP1252",
+ "6": "CP866",
+ "7": "CP852",
+ "8": "CP858"
+ },
+ "vendor": "Honeywell",
+ "model": "PC42t",
+ "description": "Versatile desktop label printer for retail and manufacturing."
}
}
diff --git a/lib/src/connectors/bluetooth.dart b/lib/src/connectors/bluetooth.dart
index 7b4808b..4cfbeca 100644
--- a/lib/src/connectors/bluetooth.dart
+++ b/lib/src/connectors/bluetooth.dart
@@ -2,8 +2,8 @@ import 'dart:async';
import 'dart:io';
import 'package:flutter/services.dart';
-import 'package:thermal_printer/discovery.dart';
-import 'package:thermal_printer/thermal_printer.dart';
+import 'package:thermal_printer_plus/discovery.dart';
+import 'package:thermal_printer_plus/thermal_printer.dart';
import 'package:rxdart/rxdart.dart';
class BluetoothPrinterInput extends BasePrinterInput {
diff --git a/lib/src/connectors/tcp.dart b/lib/src/connectors/tcp.dart
index c33532c..95e6531 100644
--- a/lib/src/connectors/tcp.dart
+++ b/lib/src/connectors/tcp.dart
@@ -3,10 +3,10 @@ import 'dart:io';
import 'dart:typed_data';
import 'package:dart_ping/dart_ping.dart';
import 'package:flutter/material.dart';
-import 'package:thermal_printer/src/models/printer_device.dart';
+import 'package:thermal_printer_plus/src/models/printer_device.dart';
import 'package:network_info_plus/network_info_plus.dart';
-import 'package:thermal_printer/discovery.dart';
-import 'package:thermal_printer/printer.dart';
+import 'package:thermal_printer_plus/discovery.dart';
+import 'package:thermal_printer_plus/printer.dart';
import 'package:ping_discover_network_forked/ping_discover_network_forked.dart';
class TcpPrinterInput extends BasePrinterInput {
diff --git a/lib/src/connectors/usb.dart b/lib/src/connectors/usb.dart
index 44312ac..a0f811f 100644
--- a/lib/src/connectors/usb.dart
+++ b/lib/src/connectors/usb.dart
@@ -2,8 +2,8 @@ import 'dart:async';
import 'dart:io';
import 'dart:typed_data';
-import 'package:thermal_printer/discovery.dart';
-import 'package:thermal_printer/thermal_printer.dart';
+import 'package:thermal_printer_plus/discovery.dart';
+import 'package:thermal_printer_plus/thermal_printer.dart';
class UsbPrinterInput extends BasePrinterInput {
final String? name;
diff --git a/lib/src/printer_manager.dart b/lib/src/printer_manager.dart
index a149b50..00e7e22 100644
--- a/lib/src/printer_manager.dart
+++ b/lib/src/printer_manager.dart
@@ -1,6 +1,6 @@
import 'dart:io';
-import 'package:thermal_printer/thermal_printer.dart';
+import 'package:thermal_printer_plus/thermal_printer.dart';
enum PrinterType { bluetooth, usb, network }
diff --git a/lib/src/printers/escpos.dart b/lib/src/printers/escpos.dart
index 0cf157c..c010741 100644
--- a/lib/src/printers/escpos.dart
+++ b/lib/src/printers/escpos.dart
@@ -1,7 +1,7 @@
import 'dart:typed_data';
-import 'package:thermal_printer/printer.dart';
-import 'package:thermal_printer/src/utils.dart';
+import 'package:thermal_printer_plus/printer.dart';
+import 'package:thermal_printer_plus/src/utils.dart';
import 'package:image/image.dart' as img;
class EscPosPrinter extends GenericPrinter {
diff --git a/lib/src/printers/star.dart b/lib/src/printers/star.dart
index 4b7cb66..cd3b659 100644
--- a/lib/src/printers/star.dart
+++ b/lib/src/printers/star.dart
@@ -1,7 +1,7 @@
import 'dart:typed_data';
import 'package:enum_to_string/enum_to_string.dart';
-import 'package:thermal_printer/printer.dart';
+import 'package:thermal_printer_plus/printer.dart';
// import 'package:flutter_star_prnt/flutter_star_prnt.dart';
enum StarEmulation { StarPRNT, StarLine, StarGraphic }
diff --git a/lib/src/printers/tspl.dart b/lib/src/printers/tspl.dart
index 74fc8ef..35ad4e5 100644
--- a/lib/src/printers/tspl.dart
+++ b/lib/src/printers/tspl.dart
@@ -1,6 +1,6 @@
import 'dart:core';
import 'dart:typed_data';
-import 'package:thermal_printer/printer.dart';
+import 'package:thermal_printer_plus/printer.dart';
import 'package:image/image.dart' as img;
import '../utils.dart';
diff --git a/pubspec.yaml b/pubspec.yaml
index 75bf575..834b8c8 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,7 +1,7 @@
-name: thermal_printer
+name: thermal_printer_plus
description: A flutter plugin that prints esc commands to printers in different platforms such as android, ios, windows and different interfaces Bluetooth and BLE, TCP and USB
-version: 1.0.5
-homepage: https://github.com/codingdevs/thermal_printer
+version: 1.0.12
+homepage: https://github.com/nasibudesign/thermal_printer/
# This package supports all platforms listed below.
platforms:
@@ -10,7 +10,7 @@ platforms:
windows:
environment:
- sdk: '>=2.18.4 <4.0.0'
+ sdk: '>=3.4.1 <4.0.0'
flutter: ">=1.20.0"
dependencies:
@@ -18,11 +18,11 @@ dependencies:
sdk: flutter
enum_to_string: ^2.0.1
- image: ^4.1.3
+ image: ^4.5.2
- network_info_plus: ^4.1.0
+ network_info_plus: 6.1.2
ping_discover_network_forked: ^0.0.1
- rxdart: ^0.27.7
+ rxdart: ^0.28.0
gbk_codec: ^0.4.0
hex: ^0.2.0
dart_ping: ^9.0.1
@@ -52,7 +52,7 @@ flutter:
assets:
- assets/resources/capabilities.json
- - packages/thermal_printer/resources/capabilities.json
+ - packages/thermal_printer_plus/resources/capabilities.json
# To add assets to your plugin package, add an assets section, like this:
# assets:
diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt
index 2b836de..d94d41b 100644
--- a/windows/CMakeLists.txt
+++ b/windows/CMakeLists.txt
@@ -1,15 +1,15 @@
cmake_minimum_required(VERSION 3.15)
-set(PROJECT_NAME "thermal_printer")
+set(PROJECT_NAME "thermal_printer_plus")
project(${PROJECT_NAME} LANGUAGES CXX)
# This value is used when generating builds using this plugin, so it must
# not be changed
-set(PLUGIN_NAME "thermal_printer_plugin")
+set(PLUGIN_NAME "thermal_printer_plus_plugin")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_library(${PLUGIN_NAME} SHARED
- "thermal_printer_plugin.cpp"
+ "thermal_printer_plus_plugin.cpp"
"include/printer.cpp"
"include/printer.h"
"include/utils.hpp"
diff --git a/windows/include/thermal_printer/thermal_printer_plugin.h b/windows/include/thermal_printer_plus/thermal_printer_plugin.h
similarity index 100%
rename from windows/include/thermal_printer/thermal_printer_plugin.h
rename to windows/include/thermal_printer_plus/thermal_printer_plugin.h
diff --git a/windows/thermal_printer_plugin.cpp b/windows/thermal_printer_plus_plugin.cpp
similarity index 98%
rename from windows/thermal_printer_plugin.cpp
rename to windows/thermal_printer_plus_plugin.cpp
index fbaa30a..c095ad0 100644
--- a/windows/thermal_printer_plugin.cpp
+++ b/windows/thermal_printer_plus_plugin.cpp
@@ -1,4 +1,4 @@
-#include "include/thermal_printer/thermal_printer_plugin.h"
+#include "include/thermal_printer_plus/thermal_printer_plugin.h"
// This must be included before many other Windows headers.
#include