Skip to content

Commit ed3f54f

Browse files
committed
fix macos entitlements for example & use raw value for sample
1 parent 447996d commit ed3f54f

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ the sample recommends using `hasCameraPermission`, which also guards against cam
1313

1414
Bugs fixed:
1515
* 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.
1617

1718
## 5.2.3
1819

example/lib/barcode_scanner_analyze_image.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ class _BarcodeScannerAnalyzeImageState
2222
final XFile? file =
2323
await ImagePicker().pickImage(source: ImageSource.gallery);
2424

25-
if (!mounted || file == null) {
25+
if (!mounted) {
26+
return;
27+
}
28+
29+
if (file == null) {
30+
setState(() {
31+
_barcodeCapture = null;
32+
});
2633
return;
2734
}
2835

@@ -43,7 +50,7 @@ class _BarcodeScannerAnalyzeImageState
4350

4451
if (_barcodeCapture != null) {
4552
label = Text(
46-
_barcodeCapture?.barcodes.firstOrNull?.displayValue ??
53+
_barcodeCapture?.barcodes.firstOrNull?.rawValue ??
4754
'No barcode detected',
4855
);
4956
}

example/macos/Runner/DebugProfile.entitlements

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@
1010
<true/>
1111
<key>com.apple.security.network.server</key>
1212
<true/>
13+
<key>com.apple.security.files.user-selected.read-only</key>
14+
<true/>
1315
</dict>
1416
</plist>

0 commit comments

Comments
 (0)