Skip to content

Commit 08591ed

Browse files
authored
Merge pull request #150 from myygunduz/master
Add returnImage parameter to AiBarcodeScanner
2 parents 50a788f + cf37871 commit 08591ed

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/src/ai_barcode_scanner.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ class AiBarcodeScanner extends StatefulWidget {
115115
/// Custom icon for the flashlight when off
116116
final IconData flashOffIcon;
117117

118+
/// Whether to return the raw image data (Uint8List) along with the BarcodeCapture.
119+
/// This can be useful for post-scan image processing such as color analysis or saving the frame.
120+
/// Defaults to `false`.
121+
final bool returnImage;
122+
118123
const AiBarcodeScanner({
119124
super.key,
120125
this.fit = BoxFit.cover,
@@ -144,6 +149,7 @@ class AiBarcodeScanner extends StatefulWidget {
144149
this.cameraSwitchIcon = CupertinoIcons.arrow_2_circlepath,
145150
this.flashOnIcon = CupertinoIcons.bolt_fill,
146151
this.flashOffIcon = CupertinoIcons.bolt,
152+
this.returnImage = false,
147153
});
148154

149155
@override
@@ -168,7 +174,10 @@ class _AiBarcodeScannerState extends State<AiBarcodeScanner> {
168174
DeviceOrientation.portraitDown,
169175
]);
170176
}
171-
_controller = widget.controller ?? MobileScannerController();
177+
_controller = widget.controller ?? MobileScannerController(
178+
// Passes the returnImage flag to control whether frame images are returned with barcode data
179+
returnImage: widget.returnImage,
180+
);
172181
}
173182

174183
@override

0 commit comments

Comments
 (0)