#Flutter Tutorial – Save Selected Image in App Directory in separate Thread (coderzheaven.com)
In this article, we will how to select an image by capturing from camera or gallery, then we will save the image in app’s temporary directory in a separate thread and then load it from there.
For this demo we need three packages.
Open pubspec.yaml file and then add the below dependencies.
path_provider for getting access to the app’s directory.
image_picker for open camera or gallery and get the image.
image for encoding and decoding the image.
Make the following changes in your Android and iOS project.
Add the following keys to your Info.plist file, located in project root/ios/Runner/Info.plist:
NSPhotoLibraryUsageDescription – describe why your app needs permission for the photo library. This is called Privacy – Photo Library Usage Description in the visual editor.
NSCameraUsageDescription – describe why your app needs access to the camera. This is called Privacy – Camera Usage Description in the visual editor.
NSMicrophoneUsageDescription – describe why your app needs access to the microphone, if you intend to record videos. This is called Privacy – Microphone Usage Description in the visual editor.
No configuration required - the plugin should work out of the box.
API less than 29
Add android:requestLegacyExternalStorage=”true” as an attribute to the application tag in AndroidManifest.xml. The attribute is false by default on apps targeting Android Q.
Medium Article Link: