#Flutter Tutorial - Save Selected Image in App Directory in separate Thread (coderzheaven.com)

Mobile Programmer
Mobile Programmer
12.5 هزار بار بازدید - 4 سال پیش - In this article, we will
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.

Add Dependencies
Open pubspec.yaml file and then add the below dependencies.
path_provider: ^1.6.9
image_picker: ^0.6.7
image: ^2.1.4
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.

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

Android
API 29+
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:
Medium: select-image-from-camera-gallery-save-image-in-apps-directory-in-separate-thread-load-image

Article Link:
http://www.coderzheaven.com/2020/06/0...

Source Code
https://bitbucket.org/vipinvijayan198...
4 سال پیش در تاریخ 1399/03/18 منتشر شده است.
12,529 بـار بازدید شده
... بیشتر