【发布时间】:2020-04-12 06:33:12
【问题描述】:
复制步骤 创建一个颤振应用程序。尝试使用 image_picker 插件的最基本功能。
预期结果:
当您从图库中选择图像时,它应该会向您的应用程序返回一些内容。文件或位置。真的什么都行。
实际结果:
什么都没有。画廊启动。您选择一个图像。图库消失了,应用程序根本没有返回任何内容。只留下null。
我的代码
Future getImage() async {
var image = await ImagePicker.pickImage(source: ImageSource.gallery);
customImageFile = image.toString();
print('customImageFile: ' + customImageFile);
}
代码输出
customImageFile: null
插件版本
image_picker: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!
【问题讨论】:
-
print('customImageFile: ' + image.runtimeType.toString());结果为 Null。
标签: flutter imagepicker