Open in-ealcocer opened 1 year ago
I had the same problem
Resolving dependencies... The lower bound of "sdk: '>=2.1.0 <3.0.0'" must be 2.12.0' or higher to enable null safety.
The current Dart SDK (3.0.5) only supports null safety.
For details, see https://dart.dev/null-safety
@waqadArshad does it work?
I have this result
@wrjcs for an image, or for normal print? coz I just updated the image version and implemented the required updates in the code based on the changed functions in the image package and I tried to be very careful in that. Please let me know what you are having issues with and I'll update you after checking it again.
For image It got your code, I print it as the image above Did you teste your code, does it work correctly?
@wrjcs as far as text based print is concerned, yes, I did test it and it was working properly. But I did not test it with an image so can't surely say anything about that. and for your print, I cannot make out if it was a text based print or an image based one. so let me know which one is that and I'll check it.
@wrjcs ok. sorry, I misread your message. So it was an image. As I mentioned, I did not test it with an image. And if you can wait, I'm kinda busy tomorrow, so I'll probably check this on Monday. Please make sure to remind me about that. Thanks
@waqadArshad Thank you for your réponse. Sure, I can wait I’m waiting for you
@wrjcs can you please share this image here? I mean the image that you are trying to print. Thanks
@wrjcs I checked and it prints alright. I don't think the problem is with this package. You should check your implementation or your printer settings.
I just printed this image:
and this is the result:
I printed more images than just this one but I'm adding this one for your reference.
Please let me know if you need any more help.
hello, this is my image original could you give the the code that you load image and print Thanks.
@wrjcs Sure, here it is:
Use the following import:
import 'package:image/image.dart' as img;
And then use this in your print method.
List<int> bytes = [];
// Xprinter XP-N160I
final profile = await CapabilityProfile.load(name: 'XP-N160I');
final generator = Generator(PaperSize.mm80, profile);
bytes += generator.setGlobalCodeTable('CP1252');
bytes += generator.text('Test Print', styles: const PosStyles(align: PosAlign.center));
bytes += generator.hr();
//+ ~~~~~~~~~~~~~~~~~~~~~~~~ Image Section ~~~~~~~~~~~~~~~~~~~~~~~~~~~
final ByteData data = await rootBundle.load(Assets.checkImages5665450);
final Uint8List imageBytes = data.buffer.asUint8List();
final img.Image image = img.decodeImage(imageBytes)!;
final img.Image resized = img.copyResize(image, width: 558);
bytes += generator.image(resized);
//! ~~~~~~~~~~~~~~~~~~~~~~~~ Image Section End ~~~~~~~~~~~~~~~~~~~~~~~~~
// printEscPos is the default method from another package (link provided below):
printEscPos(bytes, generator, context);
}
printEscPos is the default method from the example of: flutter_pos_printer_platform
@andrey-ushakov if you can delete my comments, telling people to use my fork in which I was also going to add all (or most of) the code from the Pull Requests and definitely do extensive testing for each, then I believe you can also maintain the repo. I was not trying to take over your package or something. It was always going to be your fork, I just wanted to get the users an updated version of it. But it's alright. I just wanted to say this because I and all other users need you to either maintain it or assign someone else to maintain this package. Many developers depend on it, so please consider this a humble request and update and maintain the package.
And Thanks a lot for this amazing package. I appreciate the efforts and time you put into it. And I am extremely sorry for any misunderstanding.
@waqadArshad Hello ! can u help me with this error
RangeError (index): Invalid value: Not in inclusive range 0..9638: 9639
what is causing this @TamirlanBir?
I can't add this dependency because it depends on a lower version of the image package. It also isn't compatible with the newest version of flutter. My question is if are you planning on upgrading the dependency? Here is the error log: `The current Dart SDK version is 3.0.3.
Because esc_pos_printer >=4.1.0 depends on image ^3.0.2 and esc_pos_printer <4.1.0 doesn't support null safety, every version of esc_pos_printer requires image ^3.0.2. So, because thor depends on both image ^4.0.17 and esc_pos_printer
any, version solving failed.
The lower bound of "sdk: '>=2.1.0 <3.0.0'" must be 2.12.0 or higher to enable null safety. For details, see https://dart.dev/null-safety`