I am using latest version of image_pickerplugin, including Flutter 2.0.3 version and also this is failing on a real device(Xiaomi Redmi Note 7).The only message I can see is Lost connection to device when I take the camera. Gallery works fine.This is my code.

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),

class MyHomePage extends StatefulWidget {
  _MyHomePageState createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  File _image;
  final picker = ImagePicker();

  Future getImage() async {
    final pickedFile = await picker.getImage(source: ImageSource.camera);

    setState(() {
      if (pickedFile != null) {
        _image = File(pickedFile.path);
      } else {
        print('No image selected.');

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Image Picker Example'),
      body: Center(
        child: _image == null
            ? Text('No image selected.')
            : Image.file(_image),
      floatingActionButton: FloatingActionButton(
        onPressed: getImage,
        tooltip: 'Pick Image',
        child: Icon(Icons.add_a_photo),

I already added all permissions.How can solve this problem?

Solution 1: Jitesh Mohite

Add to the menifest android:requestLegacyExternalStorage="true"

android {
    compileSdkVersion 29
// ....
        defaultConfig {
            targetSdkVersion 29

This should work for you, if want to know more about then click android:requestLegacyExternalStorage