theyakka/qr.flutter

Flutter qr_flutter package incompatible with printing package

abdulrehmananwar opened this issue · 5 comments

when i add printing: ^5.9.2 in pubspec.yaml it show follow error please resolve it

Because qr_flutter >=4.0.0 depends on qr ^2.0.0 and barcode >=2.2.0 depends on qr ^3.0.0, qr_flutter >=4.0.0 is incompatible with barcode >=2.2.0.
And because pdf >=3.7.1 depends on barcode ^2.2.0, qr_flutter >=4.0.0 is incompatible with pdf >=3.7.1.
And because printing 5.9.2 depends on pdf ^3.7.2 and no versions of printing match >5.9.2 <6.0.0, qr_flutter >=4.0.0 is incompatible with printing ^5.9.2.
So, because TAG depends on both printing ^5.9.2 and qr_flutter ^4.0.0, version solving failed.
pub get failed (1; So, because TAG depends on both printing ^5.9.2 and qr_flutter ^4.0.0, version solving failed.)

@abdulrehmananwar I thought updating the qr package that this package depends upon would remove this issue but the problem is that in the updated qr package version which is 3.0.1, the QrImage widget type is changed from Widget? to QrImage?. which means that we cannot use QrImage as a Widget now.

So, did u find a solution?

There is a mismatch between qr_flutter and printing.

"printing: any" gives warning:

/C:/Users/admin/flutter/.pub-cache/hosted/pub.dartlang.org/printing-5.6.5/lib/src/preview/pdf_preview.dart:169:35: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/Users/admin/flutter/packages/flutter/lib/src/widgets/binding.dart').
    final locale = WidgetsBinding.instance!.window.locale;
                                  ^
/C:/Users/admin/flutter/.pub-cache/hosted/pub.dartlang.org/printing-5.6.5/lib/src/preview/pdf_preview.dart:214:37: Warning: Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/Users/admin/flutter/packages/flutter/lib/src/widgets/binding.dart').
      final locale = WidgetsBinding.instance!.window.locale;

"printing: ^5.9.2" gives error:

Because no versions of qr_flutter match >4.0.0 <5.0.0 and qr_flutter 4.0.0 depends on qr ^2.0.0, qr_flutter ^4.0.0 requires qr ^2.0.0.
And because barcode >=2.2.0 depends on qr ^3.0.0, qr_flutter ^4.0.0 is incompatible with barcode >=2.2.0.
Because pdf >=3.7.1 <3.8.3 depends on barcode ^2.2.0 and pdf >=3.8.3 depends on barcode ^2.2.3, pdf >=3.7.1 requires barcode ^2.2.0.
Thus, qr_flutter ^4.0.0 is incompatible with pdf >=3.7.1.
And because printing >=5.7.3 depends on pdf ^3.7.2, qr_flutter ^4.0.0 is incompatible with printing >=5.7.3.
So, because food_app depends on both printing ^5.9.2 and qr_flutter ^4.0.0, version solving failed.
pub get failed (1; So, because food_app depends on both printing ^5.9.2 and qr_flutter ^4.0.0, version solving failed.)

This will keep happening and if u try to change the version of qr package this package depends upon, you will not be able to use the QrImage widget which would then throw an error. so I suggest you use:

barcode: ^2.2.3

which has all the code you might require in your project from outputting an image to outputting a printed document in the example they have provided in the demo folder of their repo at: https://github.com/DavBfr/dart_barcode

Narven commented

This worked with me:

  pdf:
  printing: ^5.0.0
  qr_flutter: ^4.0.0

@Narven @waqadArshad @ystekno @abdulrehmananwar the maintainer seems inactive, I have fixed the issue in my PR: #204

And uploaded a new version of the package (4.1.0): https://pub.dev/packages/qr_widget

You can report issues with the package in my new repo: https://github.com/vanyasem/qr.widget