重现步骤创建一个颤振应用程序。尝试使用 image_picker 插件的最基本功能。
预期成绩:
当您从图库中选择图像时,它应该向您的应用程序返回一些内容。文件或位置。真的什么都有。
实际结果:
没有什么。画廊启动。您选择一个图像。图库消失了,应用程序根本没有返回任何内容。只是留下空。
我的代码
Future getImage() async {
var image = await ImagePicker.pickImage(source: ImageSource.gallery);
customImageFile = image.toString();
print('customImageFile: ' + customImageFile);
}
代码输出
customImageFile: null
插件版本
图像选择器:0.6.5
扑医生
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17763.1098], locale en-AU)
• Flutter version 1.12.13+hotfix.5 at c:\flutter
• Framework revision 27321eb (4 months ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Installations\AndroidSDK
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = C:\Installations\AndroidSDK
• Java binary at: C:\Installations\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
• All Android licenses accepted.
[√] Android Studio (version 3.5)
• Android Studio at C:\Installations\Android Studio
• Flutter plugin version 40.2.2
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
[√] Connected device (1 available)
• SM G970F • android-arm64 • Android 10 (API 29)
• No issues found!