Coder Social home page Coder Social logo

flutter_bluetooth_printer_plugin's People

Contributors

ekasetiawans avatar ettaegbe avatar minhtritc97 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flutter_bluetooth_printer_plugin's Issues

iOS Build error

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 3.0.3
[✓] 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!
- iPhone X iOS 16.1

Only prints once

After successfully printing a receipt once, subsequent attempts to print again are unsuccessful.

why not print complete? onProgress: (total, sent) ,the sent value is only 0 and total

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?

selectDevice localization

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

example app doesn't work

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

2024-05-08 10 30 11

Print delay too long

Thank you for the plugin it works perfectly well. I wonder if Can I reduce the delay speed on printing to faster?

Problems on the ios

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.

  • On android it works perfectly when sending the entire byte list, but on IOS there is a limitation that when the list is too much
    great impression does not occur, the way I found it was to divide this list and send it in parts.
 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)

  • On the native android I made some changes in terms of asking for location permission when scanning, and it worked well
    I would like your opinion and if possible a response to these changes
    Appreciate

Image Optimization

Your package has no problem. It works fine!

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.

My solution (I don't know how implement it):

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).

Receipt

Screenrecorder-2021-11-05-17-12-19-904.0.mp4

Black receipt

Screenrecorder-2021-11-05-17-17-43-662.0.mp4

iOS stuck on scanning device

I got a problem on :

  • iOS
  • iphone X
  • version 15.3.1

iso Bluetooth connection state is stuck on waiting.
so it keeps showing loading dialog.
it really slow

IMG_1848

add line feed & disable scroll on receipt

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

can't cut paper

change the code to :
final additional = [
...generator.emptyLines(addFeeds),
...generator.text('.'),
];

final additional = [
  ...generator.emptyLines(addFeeds),
  ...generator.text('.'),
  ...generator.cut(),
];

maybe the print function could trans the custom additional bytes to blue tooth device?

How to print Image without using Receipt widget?

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)

convert pdf to images

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 :
صورة واتساب بتاريخ 2022-12-18 في 16 46 35 (2)
after update and use bytes
صورة واتساب بتاريخ 2022-12-18 في 16 46 35

FlutterBluetoothPrinterPlugin.java uses or overrides a deprecated API

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

Problems with Flutter 3.x

Does not work when used in newer version of Flutter. There are missing definitions like "PaperSize" Class.

Mobile App shutting down after printing on iOS

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.

image

Example project prints receipt without any problem.

Printer model: MPT-II

Updated:
If I make a break point on this line
image
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
image

Conflict dependency on image v 3.0.1

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

control the alignment of printed widget

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

No meaningful example

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

CC @ekasetiawans

Permission Restricted State

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

Android 34 Namespace not specified

Hello. When I build the project with gradle 8.0, compilation fails because throwns this error: Namespace not specified

image

Can you add the namespace in builg.gradle?

android {
namespace "com.group_name.your_project_name"
compileSdkVersion 34

}

iOS print issues

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?

photo_2022-12-03_23-49-01

thank you

The app is crashed when the Bluetooth state is change.

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.

Not Printing Properly (Some parts are cut)

Android Version: 13
Flutter Version: 3.19.6
Dart Version: 3.3.4
Package Version: 2.16.4

20240509_154240
20240509_154349

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.

The argument type 'List<int>'

../../../../.pub-cache/hosted/pub.dev/flutter_bluetooth_printer-2.8.0/lib/src/flutter_bluetooth_printer_impl.dart:66:35:
Error: The argument type 'List' can't be assigned to the parameter type 'Uint8List'.

This occurs on Flutter 3.10.7
Screenshot 2023-09-06 at 07 03 30

Print byte characters instead of image

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)

Complete Example Project

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

why not print complete? onProgress: (total, sent) ,the sent value is only 0 and total

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.