ekasetiawans / flutter_bluetooth_printer_plugin Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
How can i change the paper size from mm58 to mm80 ?
After successfully printing a receipt once, subsequent attempts to print again are unsuccessful.
I generated receipts using widget but my printers (I tested on 2 diferent printers) took to much to print the image. They are using the same time to print a receipt against black receipt. When I printed a default text, it works fine.
Using img.Image
object we can create boxes with content a remove blank spaces. The big problem, ECS Printers can't print using coordinates. For example, print image with start at Offset(5, 10).
works fine on 2.3.0
✔
after upgrade to flutter_bluetooth_printer: ^2.6.3
the api for FlutterBluetoothPrinter.printImage
changed
no i have to pass a List<int>
instead of image from package image
i tried to use image.getBytes()
the code i use to convert pdf to image
Future<Image> convertPdfUnit8ListToImage(
Uint8List docBytes, [
double? width,
]) async {
final watch = Stopwatch()..start();
final document = await x.PdfDocument.openData(docBytes);
final page = await document.getPage(1);
final image = await page.render(
width: width ?? page.width * 3,
height: page.height * 3,
format: x.PdfPageImageFormat.png,
);
page.close();
final img = decodeImage(image!.bytes.buffer.asUint8List());
watch.stop();
log('it took ${watch.elapsed.inSeconds} Seconds');
if (img != null) return img;
throw Exception('Could not decode image');
}
but the package print a dark image blow i will
before update :
after update and use bytes
It asks the user for Bluetooth Permissions on App launch, without making any reference to the package methods in the Apps' code
Expected: only ask for bluetooth permission if app call any method from the package.
FlutterBluetoothPrinter.selectDevice(context)
is perfect to choose device, no need to rewrite it.
But is hard coded localized in English, and since it has only few texts in it i suggest to pass then m as optional parameters, i.e.:
FlutterBluetoothPrinter.selectDevice(
context,
title='Choose a device',
disabled='Bluetooth is disabled',
permit='Bluetooth is not permitted',
unknown='(unknown)',
);
P.S.: I really appreciate flutter_bluetooth_printer_plugin. I wrote a reporting system for ESC/POS and I use it to write to the printer. See https://github.com/claudiodriussi/dot_report
Hi, i got some problems when I try to print for 2nd time. First time, it when though great till it reach the end, some lines can't be create, make it missing the last line. Then, i try it again, this time, i got all symbols, nothing else. So, i try turn off the printer and turn back on, now it normal and i try to print again, it make that error again. Same go for turn off bluetooth and turn back on (Android still got crashed when turn on Bluetooth)
hi @ekasetiawans, how can i change paper size from 58mm to 80mm ? thank in advance.
Hello.
I've made a simple project based on example.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bluetooth_printer/flutter_bluetooth_printer.dart';
void main() {
runApp(const MyApp());
}
// class Ticket{
// Future<List<int>> getSimpleTicket() async{
//
// var profile = await CapabilityProfile.load();
// var ticketGenerator = Generator(PaperSize.mm58, profile);
// var ticket = <int>[];
// ticket += ticketGenerator.feed(1);
// return ticket;
// }
// }
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
useMaterial3: true,
colorSchemeSeed: Colors.blue,
appBarTheme: const AppBarTheme(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
),
),
),
home: const ReceiptToPrint(),
);
}
}
class ReceiptToPrint extends StatefulWidget {
const ReceiptToPrint({Key? key}) : super(key: key);
@override
State<ReceiptToPrint> createState() => _ReceiptToPrintState();
}
class _ReceiptToPrintState extends State<ReceiptToPrint> {
ReceiptController? controller;
String? address;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: Receipt(
builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: const [
FittedBox(
fit: BoxFit.cover,
child: Text(
'PURCHASE RECEIPT',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
)
],
);
},
onInitialized: (controller) {
this.controller = controller;
},
),
),
ElevatedButton(
onPressed: () async {
final selectedAddress = address ??
(await FlutterBluetoothPrinter.selectDevice(context))
?.address;
if (selectedAddress != null) {
controller?.print(address: selectedAddress);
}
},
child: const Text('PRINT'),
),
],
),
);
}
}
After printing on paper application shutting down immediately with following exception:
Bluetooth power on
Rx:BEF8D6C9-9C21-4C9E-B632-BD58C1009F9F
Tx:BEF8D6C9-9C21-4C9E-B632-BD58C1009F9F
transparentDataReadChar -> (null)
Rx:49535343-8841-43F4-A8D4-ECBE34729BB3
Tx:49535343-1E4D-4BD9-BA61-23C647249616
Rx:49535343-8841-43F4-A8D4-ECBE34729BB3
Tx:49535343-1E4D-4BD9-BA61-23C647249616
*** Assertion failure in -[CBCentralManager cancelPeripheralConnection:options:], CBCentralManager.m:664
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: peripheral != nil'
*** First throw call stack:
(0x181ac90fc 0x19a319d64 0x18338539c 0x19fce30ec 0x19fce31a8 0x104a8711c 0x18173b670 0x18173eb44 0x181751c48 0x181749ac4 0x181a81d84 0x181a3bf5c 0x181a4f468 0x19d5f338c 0x1843f25d0 0x184170f74 0x104a86650 0x104bcdaa4)
libc++abi: terminating with uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00000001b9029964 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`__pthread_kill:
-> 0x1b9029964 <+8>: b.lo 0x1b9029984 ; <+40>
0x1b9029968 <+12>: pacibsp
0x1b902996c <+16>: stp x29, x30, [sp, #-0x10]!
0x1b9029970 <+20>: mov x29, sp
Target 0: (Runner) stopped.
Lost connection to device.
Example project prints receipt without any problem.
Printer model: MPT-II
Updated:
If I make a break point on this line
and press resume on each hit, the exception isn't throwing. It seems that it's need to be added some delay or something.
Another Update:
Added 1 second delay before disconnecting printer. The problem is gone
the sent value is only 0 and total ,not has the other progress?
I/flutter ( 9951): sent = 0 ,total = 32277
I/flutter ( 9951): progress = 0.0 , sent = 0 ,total = 32277
I/flutter ( 9951): sent = 32277 ,total = 32277
I/flutter ( 9951): progress = 1.0 , sent = 32277 ,total = 32277
D/BluetoothSocket( 9951): close() this: android.bluetooth.BluetoothSocket@5fd79c3, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@7d87240, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@7785579, mSocket: android.net.LocalSocket@cdd72be impl:android.net.LocalSocketImpl@33ef1f fd:java.io.FileDescriptor@9f2726c, mSocketState: CONNECTED
D/BluetoothSocket( 9951): close() this: android.bluetooth.BluetoothSocket@5fd79c3, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@7d87240, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@7785579, mSocket: null, mSocketState: CLOSED
why not print complete?
I wanted to create pull request to add one more feature to this plugin, but I couldn't. Please give me permission to this account or this email [email protected]
I work on example project that available in this repository. When I debug to iOS device, it failed showing this error.
Running pod install...
Running Xcode build...
Xcode build done. 7.6s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
Writing result bundle at path:
/var/folders/kw/ckbfnc91223b1yyc3q6rkpyr0000gn/T/flutter_tools.hiYTEE/flutter_ios_build_temp_dirkhrjfP/temporary_xcresult_bundle
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:85:34: error: 'CBManagerState' is only available in iOS 10.0 or newer
public var didInitialized: ((CBManagerState) -> ())?
^
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:73:14: note: add @available attribute to enclosing class
public class BluetoothPrinterManager {
^
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:106:76: error: 'CBManagerState' is only available in iOS 10.0 or newer
public init(delegate: PrinterManagerDelegate? = nil, didInitialized: ((CBManagerState) -> ())? = nil) {
^
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:106:12: note: add @available attribute to enclosing initializer
public init(delegate: PrinterManagerDelegate? = nil, didInitialized: ((CBManagerState) -> ())? = nil) {
^
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:73:14: note: add @available attribute to enclosing class
public class BluetoothPrinterManager {
^
note: Building targets in dependency order
note: Removed stale file '/Users/netscape/Library/Developer/Xcode/DerivedData/Runner-duqpcnhzchuamheogqafrawgdeyx/Build/Products/Debug-iphoneos/Runner.app'
note: Removed stale file '/Users/netscape/Library/Developer/Xcode/DerivedData/Runner-duqpcnhzchuamheogqafrawgdeyx/Build/Products/Debug-iphoneos/device_info_plus/device_info_plus.framework'
note: Removed stale file '/Users/netscape/Library/Developer/Xcode/DerivedData/Runner-duqpcnhzchuamheogqafrawgdeyx/Build/Products/Debug-iphoneos/Pods_Runner.framework'
note: Removed stale file '/Users/netscape/Library/Developer/Xcode/DerivedData/Runner-duqpcnhzchuamheogqafrawgdeyx/Build/Products/Debug-iphoneos/flutter_bluetooth_printer/flutter_bluetooth_printer.framework'
note: Removed stale file '/Users/netscape/Library/Developer/Xcode/DerivedData/Runner-duqpcnhzchuamheogqafrawgdeyx/Build/Products/Debug-iphoneos/pdfx/pdfx.framework'
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/example/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'flutter_bluetooth_printer' from project 'Pods')
warning: Run script build phase 'Thin Binary' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
warning: Run script build phase 'Run Script' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Runner' from project 'Runner')
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/example/ios/Pods/Pods.xcodeproj: warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 9.0, but the range of supported deployment target versions is 11.0 to 16.1.99. (in target 'Flutter' from project 'Pods')
Result bundle written to path:
/var/folders/kw/ckbfnc91223b1yyc3q6rkpyr0000gn/T/flutter_tools.hiYTEE/flutter_ios_build_temp_dirkhrjfP/temporary_xcresult_bundle
Could not build the precompiled application for the device.
Swift Compiler Error (Xcode): 'CBManagerState' is only available in iOS 10.0 or newer
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:84:33
Swift Compiler Error (Xcode): 'CBManagerState' is only available in iOS 10.0 or newer
/Users/netscape/FlutterProject/flutter_bluetooth_printer/packages/flutter_bluetooth_printer/ios/Classes/Bluetooth/BluetoothPrinterManager.swift:105:75
Error launching application on iPhone.
I am using
[✓] Flutter (Channel stable, 3.0.3, on macOS 13.0.1 22A400 darwin-arm, locale en-ID)
• Flutter version 3.0.3 at /Users/netscape/fvm/versions/3.0.3
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 676cefaaff (6 months ago), 2022-06-22 11:34:49 -0700
• Engine revision ffe7b86a1e
• Dart version 2.17.5
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/netscape/Library/Android/sdk
• Platform android-33, build-tools 33.0.1
• ANDROID_HOME = /Users/netscape/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] VS Code (version 1.74.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.54.0
[✓] Connected device (2 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 31) (emulator)
• iPhone (mobile) • 24c3d44539c2cda9be5e1dbe420be0b63ca5a5d7 • ios • iOS 16.1.2 20B110
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
Building my apk I got the warning: FlutterBluetoothPrinterPlugin.java uses or overrides a deprecated API
.
I have to worry about it?
In my build.gradle
file I changed only minSdkVersion
form flutter.minSdkVersion
to 18
as requested by flutter build apk
by the way, I really love flutter_bluetooth_printer.
Many thanks
When start my printer and start printing first time it is working good.
https://user-images.githubusercontent.com/12073650/209156197-f1fb3299-f534-4b15-8b1b-7974f35e634e.jpeg
But when i print second time its show layout like this.
https://user-images.githubusercontent.com/12073650/209156569-154df2d5-8667-46d4-af0e-d2a5e88e04ea.jpeg
If any one have idea please share.
final additional = [
...generator.emptyLines(addFeeds),
...generator.text('.'),
...generator.cut(),
];
maybe the print function could trans the custom additional bytes to blue tooth device?
Hi there,
Thank you for your package.
I have an issue with ios printing
as you see below image
the top one is printed by an Android device and the bottom one is printed by an iOS device (iPhone 10)
I really don't know where the white line comes from and how to solve it.
By the way, why do Android devices print faster than iOS devices?
thank you
When I'm trying to enable bluetooth, the app is crashed, and throw this exception:
E/AndroidRuntime(21981): FATAL EXCEPTION: main
E/AndroidRuntime(21981): Process: com.paymentcollector, PID: 21981
E/AndroidRuntime(21981): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.bluetooth.adapter.action.STATE_CHANGED flg=0x15000010 (has extras) } in id.flutter.plugins.FlutterBluetoothPrinterPlugin$1@940ada8
E/AndroidRuntime(21981): at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1796)
E/AndroidRuntime(21981): at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(Unknown Source:2)
E/AndroidRuntime(21981): at android.os.Handler.handleCallback(Handler.java:900)
E/AndroidRuntime(21981): at android.os.Handler.dispatchMessage(Handler.java:103)
E/AndroidRuntime(21981): at android.os.Looper.loop(Looper.java:219)
E/AndroidRuntime(21981): at android.app.ActivityThread.main(ActivityThread.java:8668)
E/AndroidRuntime(21981): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(21981): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
E/AndroidRuntime(21981): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
E/AndroidRuntime(21981): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference
E/AndroidRuntime(21981): at id.flutter.plugins.FlutterBluetoothPrinterPlugin.ensurePermission(FlutterBluetoothPrinterPlugin.java:127)
E/AndroidRuntime(21981): at id.flutter.plugins.FlutterBluetoothPrinterPlugin.startDiscovery(FlutterBluetoothPrinterPlugin.java:146)
E/AndroidRuntime(21981): at id.flutter.plugins.FlutterBluetoothPrinterPlugin.access$100(FlutterBluetoothPrinterPlugin.java:39)
E/AndroidRuntime(21981): at id.flutter.plugins.FlutterBluetoothPrinterPlugin$1.onReceive(FlutterBluetoothPrinterPlugin.java:83)
E/AndroidRuntime(21981): at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1786)
E/AndroidRuntime(21981): ... 8 more
I/Process (21981): Sending signal. PID: 21981 SIG: 9
Lost connection to device.
I not able to found a method to use my personalized text for various component of this library, the language is english but if I need other language what is the way? thank you!
Android Version: 13
Flutter Version: 3.19.6
Dart Version: 3.3.4
Package Version: 2.16.4
First photo is taken from the app using the Receipt
widget. Second photo is the printed result. The printed barcode is smaller compared to the one in the widget. Also, the upper portion of the receipt is skipped (from Account No
to Current Usage
). Almost seem like it was cut-out.
Does not work when used in newer version of Flutter. There are missing definitions like "PaperSize" Class.
What are the supported printers?
Does it work withe the printers supported by package esc_pos_bluetooth?
This is my code :
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Receipt(
backgroundColor: AppColors.white,
onInitialized: (ctr) {
controller = ctr;
},
builder: (context) => Container(
padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 48.h),
child: Column(
children: [
SizedBox(
width: 250.w,
child: QrImage(
data: jsonEncode(qrJson),
version: QrVersions.auto,
backgroundColor: AppColors.white,
),
),
SizedBox(height: 24.h),
_buildText(
isEnglish ? event.nameEn : event.nameAr,
),
SizedBox(height: 12.h),
_buildText(phoneNumber),
SizedBox(height: 12.h),
_buildText(
DateFormatter.getDDMMYYYY2(eventDay, code: code)),
SizedBox(height: 12.h),
_buildText(isEnglish
? event.locationNameEn
: event.locationNameAr),
],
),
),
),
),
],
),
the widget is printed in leftCenter of papper. how can align it in the center? , as the widget in the center of screen.
thanks
hi, i just clone an example app, it doesn't work. any idea ?
Flutter (Channel stable, 3.19.6, on macOS 14.0 23A344 darwin-arm64, locale en-KH)
• Flutter version 3.19.6 on channel stable at /Users/kaiju/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 54e66469a9 (3 weeks ago), 2024-04-17 13:08:03 -0700
• Engine revision c4cd48e186
• Dart version 3.3.4
• DevTools version 2.31.1
StreamBuilder( stream: FlutterBluetoothPrinter.discovery, builder: (context, snapshot) { log(snapshot.data.toString()); final list = snapshot.data ?? <BluetoothDevice>[]; return Text(list.toString()); })
the list is providing me an instance of Permission Restricted State
First of all thank you very much for the package which is very good.
I'll explain how I'm using your plugin to print.
For greater customization I'm generating the HTML prints
and I'm converting them to image using this package https://pub.dev/packages/webcontent_converter but since it's not null-safety I forked it and I'm using it straight from my github
https://github.com/renanzdm/webcontent_convert_forked I intend to upload it if the author does not update it.
final len = data.length;
List<List<int>> chunks = [];
for (var i = 0; i < len; i += 100) {
var end = (i + 100 < len) ? i + 100 : len;
chunks.add(data.sublist(i, end));
}
for (var i = 0; i < chunks.length; i++) {
device.printBytes(bytes:Uint8List.fromList(chunks[i]));
}
Doing this seems to work fine on ios, and on android you need to do a check to then send the list in its normal size
as I don't know the Objective-C language, it can't implement directly in native (which I think would be ideal)
hi, first of all i really like this package easy to use , i want to add line feed (space) when printer printed and is it possible or not if i want to disable scroll on receipt. thank in advance
hi this is the only package i'm really needed, but im blind on how to use it, so can you give me a complete example of using it, the example tab on pb dev doesn't give me anything so, if u could do that i really appreciate it
I updated version from 2.3.0 to 2.6.3 then I cannot discovery bluethooth device :(
In android, everything ok but IOS...And version 2.3.0 - android i print Receipt from widget Receipt it is fast and IOS is so slow :( Please help !!!!
Can someone provide good example for this plugin and how to print test page? And some documentation what exactly this plugin offers?
I am trying to find something that fits both Android and iOS
This plugin uses the esc_pos_utils_plus package, which depends on the image package of Dart in version 3. The current version of Dart is already using image v4, and this causes some conflicts with other updated packages.
Due to the fact that this esc_pos package has not been updated for some time, I found the flutter_esc_pos_utils_image_3 package, which could be used as a replacement. It uses a mirror of the image version 3, and the required changes would be minimal.
I am using Flutter version 3.7.0.
See: https://pub.dev/packages/flutter_esc_pos_utils_image_3
Thank you for the plugin it works perfectly well. I wonder if Can I reduce the delay speed on printing to faster?
How to print Image without using Receipt widget?
How to use only FlutterBluetoothPrinter.printImage() ?
final byteData = capturedImage.buffer.asByteData();
final List<int> bytes = byteData.buffer.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes,);
final buffer = await ui.ImmutableBuffer.fromUint8List(capturedImage);
final image = await ui.ImageDescriptor.encoded(buffer);
final imageWidth = image.width;
final imageHeight = image.height;
print("imageWidth: ${imageWidth}, imageHeight: ${imageHeight}");
FlutterBluetoothPrinter.printImage(
address: bluetoothDevice!.value.address,
imageBytes: bytes,
imageWidth: imageWidth,
imageHeight: imageHeight,
addFeeds: 1,
keepConnected: true,
useImageRaster: true,
paperSize: PaperSize.mm58);
}
this my code and this is error
E/flutter ( 4048): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RangeError (index): Index out of range: index should be less than 13186: 13186
E/flutter ( 4048): #0 Uint32List.[] (dart:typed_data-patch/typed_data_patch.dart:2560:7)
E/flutter ( 4048): #1 Image.getPixel (package:image/src/image.dart:422:37)
E/flutter ( 4048): #2 convolution (package:image/src/filter/convolution.dart:26:26)
E/flutter ( 4048): #3 smooth (package:image/src/filter/smooth.dart:10:10)
E/flutter ( 4048): #4 FlutterBluetoothPrinter._blackwhiteInternal (package:flutter_bluetooth_printer/src/flutter_bluetooth_printer_impl.dart:134:15)
E/flutter ( 4048): #5 _IsolateConfiguration.applyAndTime.<anonymous closure> (package:flutter/src/foundation/_isolates_io.dart:108:21)
E/flutter ( 4048): #6 Timeline.timeSync (dart:developer/timeline.dart:160:22)
E/flutter ( 4048): #7 _IsolateConfiguration.applyAndTime (package:flutter/src/foundation/_isolates_io.dart:106:21)
E/flutter ( 4048): #8 _spawn (package:flutter/src/foundation/_isolates_io.dart:127:67)
E/flutter ( 4048): #9 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:300:17)
E/flutter ( 4048): #10 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
the sent value is only 0 and total ,not has the other progress?
I/flutter ( 9951): sent = 0 ,total = 32277
I/flutter ( 9951): progress = 0.0 , sent = 0 ,total = 32277
I/flutter ( 9951): sent = 32277 ,total = 32277
I/flutter ( 9951): progress = 1.0 , sent = 32277 ,total = 32277
D/BluetoothSocket( 9951): close() this: android.bluetooth.BluetoothSocket@5fd79c3, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@7d87240, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@7785579, mSocket: android.net.LocalSocket@cdd72be impl:android.net.LocalSocketImpl@33ef1f fd:java.io.FileDescriptor@9f2726c, mSocketState: CONNECTED
D/BluetoothSocket( 9951): close() this: android.bluetooth.BluetoothSocket@5fd79c3, channel: 1, mSocketIS: android.net.LocalSocketImpl$SocketInputStream@7d87240, mSocketOS: android.net.LocalSocketImpl$SocketOutputStream@7785579, mSocket: null, mSocketState: CLOSED
why not print complete?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.