Flutter 在Dart的主线程中强制执行
在我的Dart程序中,我使用相机:Flutter 在Dart的主线程中强制执行,flutter,dart,Flutter,Dart,在我的Dart程序中,我使用相机: ... final File imageProduct = await ImagePicker.pickImage(source: ImageSource.camera, maxHeight: 1024, maxWidth: 1024); ... 在以前的版本中,它工作得很好,现在经过颤振升级(v1.7.8+hotfix.3)后,相机界面显示,我可以拍照,之后我得到错误: W/Binder ( 7331): Caught a RuntimeExc
...
final File imageProduct = await ImagePicker.pickImage(source: ImageSource.camera, maxHeight: 1024, maxWidth: 1024);
...
在以前的版本中,它工作得很好,现在经过颤振升级(v1.7.8+hotfix.3)后,相机界面显示,我可以拍照,之后我得到错误:
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
在flatter中,异步函数是在主线程中执行的,所以我真的不明白会出现什么问题。
我找不到在主线程中强制执行的显式方法
解决办法是什么
谢谢
问题已解决。请参阅,谢谢,这只是版本问题…此解决方案有效,imagepicker的版本升级解决了问题。对我来说,它只需要第3步和重新加载项目。无需颤振升级。