edrakali
edrakali

Reputation: 175

Flutter image_picker 0.4.12+1 not returning from camera

I am using image_picker version 0.4.12+1 to take a picture from Camera on Android Emulator but the program never returns from ImagePicker.pickImage async call.

_takePicture() async{
    print("This is executed");
    var image = await ImagePicker.pickImage(source: ImageSource.camera);
    print("But is this never executed");
}

This post on Github discusses the same issue and suggests a solution by modifying onMainActivity result. How can I do that? Or is there another solution that does not involve upgrading to AndroidX?

If it helps, the call will return successfully if I am using a different ImageSource.gallery instead of a camera.

Upvotes: 2

Views: 336

Answers (1)

Thida Swe Zin
Thida Swe Zin

Reputation: 309

Using image picker version, image_picker: ^0.6.1+10 , this works.

Future _getImage() async {
    var image = await ImagePicker.pickImage(source: ImageSource.camera);
}

Upvotes: 1

Related Questions