Julian Steenbakker
Committed by GitHub

Merge branch 'master' into hotfix/hot-reload

@@ -104,6 +104,10 @@ unlinked_spec.ds @@ -104,6 +104,10 @@ unlinked_spec.ds
104 **/macos/Flutter/GeneratedPluginRegistrant.swift 104 **/macos/Flutter/GeneratedPluginRegistrant.swift
105 **/macos/Flutter/ephemeral 105 **/macos/Flutter/ephemeral
106 106
  107 +# Swift Package Manager related
  108 +.build/
  109 +.swiftpm/
  110 +
107 # Coverage 111 # Coverage
108 coverage/ 112 coverage/
109 113
  1 +## 6.0.8
  2 +Improvements:
  3 +* [Android] Remove the dependency on `org.jetbrains.kotlin:kotlin-bom`.
  4 +
1 ## 6.0.7 5 ## 6.0.7
2 Improvements: 6 Improvements:
3 * [Android] Updated bundled barcode scanning library to v17.3.0 7 * [Android] Updated bundled barcode scanning library to v17.3.0
@@ -73,10 +73,6 @@ dependencies { @@ -73,10 +73,6 @@ dependencies {
73 implementation 'com.google.mlkit:barcode-scanning:17.3.0' 73 implementation 'com.google.mlkit:barcode-scanning:17.3.0'
74 } 74 }
75 75
76 - // org.jetbrains.kotlin:kotlin-bom artifact purpose is to align kotlin stdlib and related code versions.  
77 - // See: https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7  
78 - implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.22"))  
79 -  
80 implementation 'androidx.camera:camera-lifecycle:1.3.4' 76 implementation 'androidx.camera:camera-lifecycle:1.3.4'
81 implementation 'androidx.camera:camera-camera2:1.3.4' 77 implementation 'androidx.camera:camera-camera2:1.3.4'
82 implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3' 78 implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
@@ -11,3 +11,5 @@ GeneratedPluginRegistrant.java @@ -11,3 +11,5 @@ GeneratedPluginRegistrant.java
11 key.properties 11 key.properties
12 **/*.keystore 12 **/*.keystore
13 **/*.jks 13 **/*.jks
  14 +
  15 +**/.cxx
@@ -24,7 +24,8 @@ if (flutterVersionName == null) { @@ -24,7 +24,8 @@ if (flutterVersionName == null) {
24 24
25 android { 25 android {
26 namespace "dev.steenbakker.mobile_scanner_example" 26 namespace "dev.steenbakker.mobile_scanner_example"
27 - compileSdk 34 27 + compileSdk 35
  28 + ndkVersion "26.3.11579264"
28 29
29 compileOptions { 30 compileOptions {
30 sourceCompatibility JavaVersion.VERSION_17 31 sourceCompatibility JavaVersion.VERSION_17
@@ -43,7 +44,7 @@ android { @@ -43,7 +44,7 @@ android {
43 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 44 // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
44 applicationId "dev.steenbakker.mobile_scanner_example" 45 applicationId "dev.steenbakker.mobile_scanner_example"
45 minSdkVersion 24 46 minSdkVersion 24
46 - targetSdkVersion 34 47 + targetSdkVersion 35
47 versionCode flutterVersionCode.toInteger() 48 versionCode flutterVersionCode.toInteger()
48 versionName flutterVersionName 49 versionName flutterVersionName
49 } 50 }
@@ -275,7 +275,7 @@ class _MobileScannerState extends State<MobileScanner> @@ -275,7 +275,7 @@ class _MobileScannerState extends State<MobileScanner>
275 } 275 }
276 } 276 }
277 277
278 - if (widget.onDetect != null) { 278 + if (widget.controller == null) {
279 WidgetsBinding.instance.addObserver(this); 279 WidgetsBinding.instance.addObserver(this);
280 _subscription = controller.barcodes.listen( 280 _subscription = controller.barcodes.listen(
281 widget.onDetect, 281 widget.onDetect,
@@ -289,8 +289,12 @@ class _MobileScannerState extends State<MobileScanner> @@ -289,8 +289,12 @@ class _MobileScannerState extends State<MobileScanner>
289 } 289 }
290 290
291 Future<void> disposeMobileScanner() async { 291 Future<void> disposeMobileScanner() async {
292 - await _subscription?.cancel(); 292 + if (widget.controller == null) {
293 WidgetsBinding.instance.removeObserver(this); 293 WidgetsBinding.instance.removeObserver(this);
  294 + }
  295 +
  296 + await _subscription?.cancel();
  297 + _subscription = null;
294 298
295 if (controller.autoStart) { 299 if (controller.autoStart) {
296 await controller.stop(); 300 await controller.stop();
@@ -312,12 +316,12 @@ class _MobileScannerState extends State<MobileScanner> @@ -312,12 +316,12 @@ class _MobileScannerState extends State<MobileScanner>
312 @override 316 @override
313 void dispose() { 317 void dispose() {
314 super.dispose(); 318 super.dispose();
315 - disposeMobileScanner(); 319 + unawaited(disposeMobileScanner());
316 } 320 }
317 321
318 @override 322 @override
319 void didChangeAppLifecycleState(AppLifecycleState state) { 323 void didChangeAppLifecycleState(AppLifecycleState state) {
320 - if (widget.controller != null || !controller.value.hasCameraPermission) { 324 + if (!controller.value.hasCameraPermission) {
321 return; 325 return;
322 } 326 }
323 327
@@ -327,15 +331,8 @@ class _MobileScannerState extends State<MobileScanner> @@ -327,15 +331,8 @@ class _MobileScannerState extends State<MobileScanner>
327 case AppLifecycleState.paused: 331 case AppLifecycleState.paused:
328 return; 332 return;
329 case AppLifecycleState.resumed: 333 case AppLifecycleState.resumed:
330 - _subscription = controller.barcodes.listen(  
331 - widget.onDetect,  
332 - onError: widget.onDetectError,  
333 - cancelOnError: false,  
334 - );  
335 -  
336 unawaited(controller.start()); 334 unawaited(controller.start());
337 case AppLifecycleState.inactive: 335 case AppLifecycleState.inactive:
338 - unawaited(_subscription?.cancel());  
339 unawaited(controller.stop()); 336 unawaited(controller.stop());
340 } 337 }
341 } 338 }
1 name: mobile_scanner 1 name: mobile_scanner
2 description: A universal barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS. 2 description: A universal barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS.
3 -version: 6.0.7 3 +version: 6.0.8
4 repository: https://github.com/juliansteenbakker/mobile_scanner 4 repository: https://github.com/juliansteenbakker/mobile_scanner
5 5
6 screenshots: 6 screenshots: