Julian Steenbakker
Committed by GitHub

Merge branch 'master' into hotfix/hot-reload

... ... @@ -104,6 +104,10 @@ unlinked_spec.ds
**/macos/Flutter/GeneratedPluginRegistrant.swift
**/macos/Flutter/ephemeral
# Swift Package Manager related
.build/
.swiftpm/
# Coverage
coverage/
... ...
## 6.0.8
Improvements:
* [Android] Remove the dependency on `org.jetbrains.kotlin:kotlin-bom`.
## 6.0.7
Improvements:
* [Android] Updated bundled barcode scanning library to v17.3.0
... ...
... ... @@ -73,10 +73,6 @@ dependencies {
implementation 'com.google.mlkit:barcode-scanning:17.3.0'
}
// org.jetbrains.kotlin:kotlin-bom artifact purpose is to align kotlin stdlib and related code versions.
// See: https://youtrack.jetbrains.com/issue/KT-55297/kotlin-stdlib-should-declare-constraints-on-kotlin-stdlib-jdk8-and-kotlin-stdlib-jdk7
implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.22"))
implementation 'androidx.camera:camera-lifecycle:1.3.4'
implementation 'androidx.camera:camera-camera2:1.3.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
... ...
... ... @@ -11,3 +11,5 @@ GeneratedPluginRegistrant.java
key.properties
**/*.keystore
**/*.jks
**/.cxx
\ No newline at end of file
... ...
... ... @@ -24,7 +24,8 @@ if (flutterVersionName == null) {
android {
namespace "dev.steenbakker.mobile_scanner_example"
compileSdk 34
compileSdk 35
ndkVersion "26.3.11579264"
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
... ... @@ -43,7 +44,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "dev.steenbakker.mobile_scanner_example"
minSdkVersion 24
targetSdkVersion 34
targetSdkVersion 35
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
... ...
... ... @@ -275,7 +275,7 @@ class _MobileScannerState extends State<MobileScanner>
}
}
if (widget.onDetect != null) {
if (widget.controller == null) {
WidgetsBinding.instance.addObserver(this);
_subscription = controller.barcodes.listen(
widget.onDetect,
... ... @@ -289,8 +289,12 @@ class _MobileScannerState extends State<MobileScanner>
}
Future<void> disposeMobileScanner() async {
if (widget.controller == null) {
WidgetsBinding.instance.removeObserver(this);
}
await _subscription?.cancel();
WidgetsBinding.instance.removeObserver(this);
_subscription = null;
if (controller.autoStart) {
await controller.stop();
... ... @@ -312,12 +316,12 @@ class _MobileScannerState extends State<MobileScanner>
@override
void dispose() {
super.dispose();
disposeMobileScanner();
unawaited(disposeMobileScanner());
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (widget.controller != null || !controller.value.hasCameraPermission) {
if (!controller.value.hasCameraPermission) {
return;
}
... ... @@ -327,15 +331,8 @@ class _MobileScannerState extends State<MobileScanner>
case AppLifecycleState.paused:
return;
case AppLifecycleState.resumed:
_subscription = controller.barcodes.listen(
widget.onDetect,
onError: widget.onDetectError,
cancelOnError: false,
);
unawaited(controller.start());
case AppLifecycleState.inactive:
unawaited(_subscription?.cancel());
unawaited(controller.stop());
}
}
... ...
name: mobile_scanner
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.
version: 6.0.7
version: 6.0.8
repository: https://github.com/juliansteenbakker/mobile_scanner
screenshots:
... ...