Flutter 颤振:如何从ImagePicker软件包的设备中读取图像
我想从android emulator中选择一个图像,然后将其上载到云存储。当我调用Flutter 颤振:如何从ImagePicker软件包的设备中读取图像,flutter,imagepicker,Flutter,Imagepicker,我想从android emulator中选择一个图像,然后将其上载到云存储。当我调用File image=wait ImagePicker.pickImage(源代码:ImageSource.gallery)时我得到如下错误: MissingPluginException(No implementation found for method requestPermissions on channel flutter.baseflow.com/permissions/methods) 我试图在A
File image=wait ImagePicker.pickImage(源代码:ImageSource.gallery)时代码>我得到如下错误:
MissingPluginException(No implementation found for method requestPermissions on channel flutter.baseflow.com/permissions/methods)
我试图在AndroidManifest.xml文件中设置相机权限:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.somethingdwun.dwun">
<uses-permission android:name="android.permission.CAMERA" />
<application
android:name="io.flutter.app.FlutterApplication"
android:icon="@mipmap/ic_launcher"
android:label="dwun">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
</application>
</manifest>
谢谢您是否将其添加到您的依赖项中
首先,在pubspec.yaml文件中添加图像选择器作为依赖项。
希望对你有帮助
依赖项:图像选取器:^0.6.2+3我找到了这个
无需在AndroidManifest.xml文件中添加权限。关闭应用程序,进入项目目录并尝试在命令行中运行:
flutter clean
我认为它会解决你的问题有时热重启或热重新加载不会起作用。
确保在pubspec.yaml
文件中添加图像选择器作为依赖项
关闭应用程序并执行flatter run
命令。是的,我的附件中有它。您是否可以从代码的该部分发送一张使用该代码的图片?从照相机或多媒体资料中读取图像?如果您试图从galley读取,则需要在android清单中声明读取存储权限。我不必在AndroidManifest.xml中添加任何权限。ImagePicker()直接在颤振项目目录中的flatter clean
之后工作。