image_share 0.0.1 image_share: ^0.0.1 copied to clipboard
Plugin to access the native features to share an image.
image_share #
A plugin to share an image from your Flutter app via the platform's share dialog.
Wraps the ACTION_SEND Intent on Android and UIActivityViewController on iOS.
Usage #
To use the plugin, add image_share
as a
dependency in your pubspec.yaml file.
On iOS
Add an NSPhotoLibraryAddUsageDescription
key to the
Info.plist
file.
On Android
In the AndroidManifest.xml
, add the following inside <application>
:
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="image_share"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
In app/src/main/res
, create a new xml
folder, which will contain the file
file_paths.xml
:
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path name="images" path="/"/>
</paths>
Example #
Import the library via
import 'package:image_share/image_share.dart';
Then invoke the shareFile
method anywhere in your Dart code to share a file
given its path :
ImageShare.shareFile(<PATH OF YOUR FILE>);