Aseem
Aseem

Reputation: 6787

Flutter: how to read image from a device for ImagePicker package

I want to select a image from my android emulator and then upload it to cloud storage. When I call File image = await ImagePicker.pickImage(source: ImageSource.gallery); I get error as follows:

MissingPluginException(No implementation found for method requestPermissions on channel flutter.baseflow.com/permissions/methods)

I tried to put camera permission in AndroidManifest.xml file:

<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>

Thanks

Upvotes: 0

Views: 838

Answers (3)

reza47
reza47

Reputation: 795

And i found thisMissingPluginException

No need to add permissions in AndroidManifest.xml file. Close your app, go in project directory & try running this in command line:

flutter clean

I think it will solve your problem

Upvotes: 1

Jaydeep chatrola
Jaydeep chatrola

Reputation: 2711

sometime hot restart or hot reload won't do the trick. make sure you add image_picker as a dependency in your pubspec.yaml file

Close the app and execute flutter run command.

Upvotes: 0

reza47
reza47

Reputation: 795

Did you add that in to your dependency?

First, add image_picker as a dependency in your pubspec.yaml file. Hope it will helps you

dependencies: image_picker: ^0.6.2+3

Upvotes: 0

Related Questions