Navaron Bracke

fix macos entitlements for example & use raw value for sample

@@ -13,6 +13,7 @@ the sample recommends using `hasCameraPermission`, which also guards against cam @@ -13,6 +13,7 @@ the sample recommends using `hasCameraPermission`, which also guards against cam
13 13
14 Bugs fixed: 14 Bugs fixed:
15 * Fixed a bug that would cause the scanner to emit an error when it was already started. Now it ignores any calls to start while it is starting. 15 * Fixed a bug that would cause the scanner to emit an error when it was already started. Now it ignores any calls to start while it is starting.
  16 +* [MacOS] Fixed a bug that prevented the `anaylzeImage()` sample from working properly.
16 17
17 ## 5.2.3 18 ## 5.2.3
18 19
@@ -22,7 +22,14 @@ class _BarcodeScannerAnalyzeImageState @@ -22,7 +22,14 @@ class _BarcodeScannerAnalyzeImageState
22 final XFile? file = 22 final XFile? file =
23 await ImagePicker().pickImage(source: ImageSource.gallery); 23 await ImagePicker().pickImage(source: ImageSource.gallery);
24 24
25 - if (!mounted || file == null) { 25 + if (!mounted) {
  26 + return;
  27 + }
  28 +
  29 + if (file == null) {
  30 + setState(() {
  31 + _barcodeCapture = null;
  32 + });
26 return; 33 return;
27 } 34 }
28 35
@@ -43,7 +50,7 @@ class _BarcodeScannerAnalyzeImageState @@ -43,7 +50,7 @@ class _BarcodeScannerAnalyzeImageState
43 50
44 if (_barcodeCapture != null) { 51 if (_barcodeCapture != null) {
45 label = Text( 52 label = Text(
46 - _barcodeCapture?.barcodes.firstOrNull?.displayValue ?? 53 + _barcodeCapture?.barcodes.firstOrNull?.rawValue ??
47 'No barcode detected', 54 'No barcode detected',
48 ); 55 );
49 } 56 }
@@ -10,5 +10,7 @@ @@ -10,5 +10,7 @@
10 <true/> 10 <true/>
11 <key>com.apple.security.network.server</key> 11 <key>com.apple.security.network.server</key>
12 <true/> 12 <true/>
  13 + <key>com.apple.security.files.user-selected.read-only</key>
  14 + <true/>
13 </dict> 15 </dict>
14 </plist> 16 </plist>