Skip to content

Why does Flutter Image Picker take 2-3 seconds to capture an image from the camera on Android? #128242

@ElGenius-developer

Description

@ElGenius-developer

Is there an existing issue for this?

Steps to reproduce

When I try to pick image using image_picker package , camera open file , but when I click capture button it takes about 2 or 3 seconds to capture image , any solutions ? code:

Expected results

Expect to shoot image fast and loading may take seconds

Actual results

when clicked on capture button I heard a sound of shooting but image not captured , after few seconds of lagging image cached with the old frame

Code sample

Code sample
void pickImageFromCam() async {
try {
await ImagePicker()
          .pickImage(
source: kIsWeb ? ImageSource.gallery : ImageSource.camera,
requestFullMetadata: true,
imageQuality: 90,
maxHeight: 500,
maxWidth: 500)
          .then((value) {
if (value != null) {
if (imagesExtensions.contains(getExtension(value.name))) {
pickedFiles.add(CustomPickedFile(
file: File(value.path),
path: value.path,
fileExtension: getExtension(value.name),
fileName: value.name));

Helper.showSnackBar(context,
message: AppLocal.of(context).image_was_taken);
else {
_showDialog(
title: AppLocal.of(context).take_photo,
content: AppLocal.of(context)
                    .extension_should_be(imagesExtensions.join(' , ')));
          }
else {
_showDialog(
title: AppLocal.of(context).take_photo,
content: AppLocal.of(context).no_image_was_taken);
        }
      });
on IOException catch (error) {
log(error.toString());
    }
  }

Screenshots or Video

Screenshots / Video demonstration

image_picker gif

Logs

Logs
no logs

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.10.3, on Microsoft Windows [Version 10.0.19045.2965], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Enterprise 2019 16.11.26)
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop
      development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK
[√] Android Studio (version 2022.2)
[√] VS Code, 64-bit edition (version 1.78.2)
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 1 category.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions