diff --git a/lib/utils/image.dart b/lib/utils/image.dart index 969e571..87f7c96 100644 --- a/lib/utils/image.dart +++ b/lib/utils/image.dart @@ -10,20 +10,24 @@ extension CameraImageToInputImage on CameraImage { allBytes.putUint8List(plane.bytes); } return allBytes.done().buffer.asUint8List(); - } + } InputImage toInputImage(CameraDescription camera) { - final inputImageData = InputImageData( + final totalBytesPerRow = planes.fold( + 0, + (totalBytesPerRow, plane) => totalBytesPerRow + plane.bytesPerRow, + ); + + final inputImageData = InputImageMetadata( size: Size(width.toDouble(), height.toDouble()), - imageRotation: InputImageRotationValue.fromRawValue(camera.sensorOrientation) ?? InputImageRotation.rotation0deg, - inputImageFormat: InputImageFormatValue.fromRawValue(format.raw) ?? InputImageFormat.nv21, - planeData: planes.map((Plane plane) => InputImagePlaneMetadata( - bytesPerRow: plane.bytesPerRow, - height: plane.height, - width: plane.width, - )).toList(), + rotation: + InputImageRotationValue.fromRawValue(camera.sensorOrientation) ?? + InputImageRotation.rotation0deg, + format: InputImageFormatValue.fromRawValue(format.raw) ?? + InputImageFormat.nv21, + bytesPerRow: totalBytesPerRow, ); - return InputImage.fromBytes(bytes: getBytes(), inputImageData: inputImageData); + return InputImage.fromBytes(bytes: getBytes(), metadata: inputImageData); } } @@ -57,4 +61,4 @@ extension InputImageCrop on InputImage { ); } } -*/ \ No newline at end of file +*/ diff --git a/pubspec.lock b/pubspec.lock index 7984393..bb3be9f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,60 +1,76 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + async: + dependency: transitive + description: + name: async + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" camera: dependency: "direct main" description: name: camera - url: "https://pub.dartlang.org" + sha256: "413d2b34fe28496c35c69ede5b232fb9dd5ca2c3a4cb606b14efc1c7546cc8cb" + url: "https://pub.dev" source: hosted - version: "0.10.1" - camera_android: + version: "0.11.1" + camera_android_camerax: dependency: transitive description: - name: camera_android - url: "https://pub.dartlang.org" + name: camera_android_camerax + sha256: "26673643ed8f4a468a81ebd7ca760bc1d8c4c741df6d731cc958585ac1983126" + url: "https://pub.dev" source: hosted - version: "0.10.0+2" + version: "0.6.15" camera_avfoundation: dependency: transitive description: name: camera_avfoundation - url: "https://pub.dartlang.org" + sha256: a33cd9a250296271cdf556891b7c0986a93772426f286595eccd5f45b185933c + url: "https://pub.dev" source: hosted - version: "0.9.8+5" + version: "0.9.18+14" camera_platform_interface: dependency: transitive description: name: camera_platform_interface - url: "https://pub.dartlang.org" + sha256: "2f757024a48696ff4814a789b0bd90f5660c0fb25f393ab4564fb483327930e2" + url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.10.0" camera_web: dependency: transitive description: name: camera_web - url: "https://pub.dartlang.org" + sha256: "595f28c89d1fb62d77c73c633193755b781c6d2e0ebcd8dc25b763b514e6ba8f" + url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.3.5" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.4.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.19.1" cross_file: dependency: transitive description: name: cross_file - url: "https://pub.dartlang.org" + sha256: f71079978789bc2fe78d79227f1f8cfe195b31bbd8db2399b0d15a4b96fb843b + url: "https://pub.dev" source: hosted version: "0.3.3+2" flutter: @@ -66,14 +82,16 @@ packages: dependency: "direct dev" description: name: flutter_lints - url: "https://pub.dartlang.org" + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "5.0.0" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" + sha256: "60fc7b78455b94e6de2333d2f95196d32cf5c22f4b0b0520a628804cb463503b" + url: "https://pub.dev" source: hosted version: "2.0.7" flutter_web_plugins: @@ -85,105 +103,95 @@ packages: dependency: "direct main" description: name: google_mlkit_barcode_scanning - url: "https://pub.dartlang.org" + sha256: b38505df2d3fdf7830979d60fee55039c2f442d189b2e06fcb2fe494ba65d0db + url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.14.1" google_mlkit_commons: dependency: transitive description: name: google_mlkit_commons - url: "https://pub.dartlang.org" + sha256: "8f40fbac10685cad4715d11e6a0d86837d9ad7168684dfcad29610282a88e67a" + url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.11.0" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + sha256: a5e201311cb08bf3912ebbe9a2be096e182d703f881136ec1e81a2338a9e120d + url: "https://pub.dev" source: hosted version: "0.6.4" lints: dependency: transitive description: name: lints - url: "https://pub.dartlang.org" + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" source: hosted - version: "2.0.0" - matcher: - dependency: transitive - description: - name: matcher - url: "https://pub.dartlang.org" - source: hosted - version: "0.12.12" + version: "5.1.1" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.11.1" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" source: hosted - version: "1.8.0" - path: - dependency: transitive - description: - name: path - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.2" + version: "1.16.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" source: hosted - version: "2.1.3" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.0" + version: "2.1.8" rxdart: dependency: "direct main" description: name: rxdart - url: "https://pub.dartlang.org" + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + url: "https://pub.dev" source: hosted - version: "0.27.5" + version: "0.28.0" sky_engine: dependency: transitive description: flutter source: sdk - version: "0.0.99" - stack_trace: - dependency: transitive - description: - name: stack_trace - url: "https://pub.dartlang.org" - source: hosted - version: "1.10.0" + version: "0.0.0" stream_transform: dependency: transitive description: name: stream_transform - url: "https://pub.dartlang.org" + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "1.1.1" sdks: - dart: ">=2.17.0 <3.0.0" - flutter: ">=3.0.0" + dart: ">=3.7.0-0 <4.0.0" + flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml index 2eb0e78..fdb0172 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,19 +1,19 @@ name: code_scan description: A flexible code scanner for QR codes, barcodes and many others. Using Google's ML Kit. Use it as a Widget with a camera or use the methods provided, with a camera controller. -version: 0.4.10 +version: 1.0.0 repository: https://github.com/DrafaKiller/CodeScanner-flutter issue_tracker: https://github.com/DrafaKiller/CodeScanner-flutter/issues environment: - sdk: ">=2.17.0 <3.0.0" - flutter: ">=2.10.0" + sdk: ">=3.0.0 <4.0.0" + flutter: ">=3.22.2" dependencies: flutter: sdk: flutter - camera: ^0.10.1 - google_mlkit_barcode_scanning: ^0.6.0 - rxdart: ^0.27.4 + camera: ^0.11.1 + google_mlkit_barcode_scanning: ^0.14.1 + rxdart: ^0.28.0 dev_dependencies: - flutter_lints: ^2.0.1 + flutter_lints: ^5.0.0