Answers for "flutter camera take picture"

4

flutter capture image from camera

import 'package:image_picker/image_picker.dart';

final _imagePicker = ImagePicker();
 
var _pickedFile = await _imagePicker.getImage(source: ImageSource.camera);
File _imageFilePicked = File(_pickedFile.path);
Posted by: Guest on March-29-2021
0

how to make event take camera in flutter

void onNewCameraSelected(CameraDescription cameraDescription) async {
if (controller != null) {
  await controller.dispose();
}
controller = CameraController(
  cameraDescription,
  ResolutionPreset.high,
  enableAudio: enableAudio,
);

// If the controller is updated then update the UI.
controller.addListener(() {
  if (mounted) setState(() {});
  if (controller.value.hasError) {
    showInSnackBar('Camera error ${controller.value.errorDescription}');
  }
});

try {
  await controller.initialize();
} on CameraException catch (e) {
  _showCameraException(e);
}

if (mounted) {
  setState(() {});
}
}
Posted by: Guest on January-08-2021

Code answers related to "flutter camera take picture"

Code answers related to "Dart"

Browse Popular Code Answers by Language