@@ -646,20 +646,23 @@ class CameraPickerState extends State<CameraPicker>
646
646
return ;
647
647
}
648
648
try {
649
- final XFile _file = await controller.takePicture ();
649
+ final XFile file = await controller.takePicture ();
650
650
// Delay disposing the controller to hold the preview.
651
651
Future <void >.delayed (const Duration (milliseconds: 500 ), () {
652
652
_controller? .dispose ();
653
653
safeSetState (() {
654
654
_controller = null ;
655
655
});
656
656
});
657
- if (config.onXFileCaptured != null ) {
658
- config.onXFileCaptured !(_file, CameraPickerViewType .image);
657
+ final bool ? isCapturedFileHandled = config.onXFileCaptured? .call (
658
+ file,
659
+ CameraPickerViewType .image,
660
+ );
661
+ if (isCapturedFileHandled == true ) {
659
662
return ;
660
663
}
661
664
final AssetEntity ? entity = await _pushToViewer (
662
- file: _file ,
665
+ file: file ,
663
666
viewType: CameraPickerViewType .image,
664
667
);
665
668
if (entity != null ) {
@@ -747,8 +750,11 @@ class CameraPickerState extends State<CameraPicker>
747
750
if (controller.value.isRecordingVideo) {
748
751
try {
749
752
final XFile file = await controller.stopVideoRecording ();
750
- if (config.onXFileCaptured != null ) {
751
- config.onXFileCaptured !(file, CameraPickerViewType .video);
753
+ final bool ? isCapturedFileHandled = config.onXFileCaptured? .call (
754
+ file,
755
+ CameraPickerViewType .video,
756
+ );
757
+ if (isCapturedFileHandled == true ) {
752
758
return ;
753
759
}
754
760
final AssetEntity ? entity = await _pushToViewer (
0 commit comments