5

In my Dart program I am using the camera:

...    
final File imageProduct =  await ImagePicker.pickImage(source: ImageSource.camera, maxHeight: 1024, maxWidth: 1024);
...

In previous version it worked well, now after a Flutter upgrade (v1.7.8+hotfix.3) the camera interface is displayed, I can take the photo, after that I get error:

W/Binder  ( 7331): Caught a RuntimeException from the binder stub implementation.
W/Binder  ( 7331): java.lang.RuntimeException: Methods marked with @UiThread must be executed on the main thread. Current thread: Binder:7331_4

In Flutter asynchronous functions are executed in main thread so I really don't understand what could be the problem. I couldn't find an explicit way to force execution in main thread.

What could be the solution.

Thanks.

2

1 Answer 1

2
  1. Change flutter channel to dev (flutter channel dev). (U can omit this step)
  2. run flutter upgrade
  3. Change version of ImagePicker to latest one 0.6.3+1.
  4. Run project

Issue is solved.

Sign up to request clarification or add additional context in comments.

1 Comment

This solution works, version upgrade of imagepicker solves the issue. For me, it only required step 3 and reloading the project though. No flutter upgrade required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.