Search packages, repositories and app categories

Package detailsv2.0.0

share_extend

A Flutter plugin for Android and iOS for sharing text, image, video and file with system ui.

AndroidiOS
30-day downloads
1.1K
Likes
138
Pub points
130

Install package

flutter pub add share_extend

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

share_extend is a Flutter plugin that enables sharing of text, images, videos, and files through the native system UI on both Android and iOS. It provides a simple interface to leverage platform-specific sharing intents, allowing users to send content via email, messaging apps, social media, and more. The plugin integrates seamlessly with Flutter's ecosystem and supports cross-platform consistency while maintaining access to native sharing features. It is ideal for apps needing straightforward sharing functionality without complex setup.

Use cases

  • Sharing text snippets
  • Sending images from app
  • Distributing videos
  • Exporting files
  • Integrating with social platforms

Key features

  • Cross-platform support (Android & iOS)
  • Simple API for sharing multiple content types
  • Native system UI integration
  • Supports text, image, video, and file sharing
  • Minimal configuration required

Suitable for

  • Apps needing basic sharing
  • Content-driven applications
  • Social media integrations
  • File-sharing tools
  • Mobile apps with user-generated content

Considerations

  • Requires platform-specific permissions for certain file types
  • Limited customization of share sheet UI
  • Depends on system availability of sharing options
  • May behave differently across device manufacturers
  • No built-in analytics or tracking for shares

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Language: English | 中文简体

ShareExtend

pub package

A Flutter plugin for iOS and Android for sharing text, image, video and file with system ui.

Installation

First, add share_extend as a dependency in your pubspec.yaml file.

dependencies:
  share_extend: "^2.0.0"
iOS

Add the following key to your info.plist file, located in <project root>/ios/Runner/Info.plist for saving shared images to photo library.

<key>NSPhotoLibraryAddUsageDescription</key>
<string>describe why your app needs access to write photo library</string>
Android

If your project needs read and write permissions for sharing external storage file, please add the following permissions to your AndroidManifest.xml, located in <project root>/android/app/src/main/AndroidManifest.xml

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Import

import 'package:share_extend/share_extend.dart';

Example


//share text
ShareExtend.share("share text", "text","android share panel title","share subject");

//share image
File f =
    await ImagePicker.pickImage(source: ImageSource.gallery);
ShareExtend.share(f.path, "image");

//share video
File f = await ImagePicker.pickVideo(
        source: ImageSource.gallery);
ShareExtend.share(f.path, "video");

//share file
Directory dir = Platform.isAndroid
    ? await getExternalStorageDirectory()
    : await getApplicationDocumentsDirectory();
File testFile = new File("${dir.path}/flutter/test.txt");
if (!await testFile.exists()) {
  await testFile.create(recursive: true);
  testFile.writeAsStringSync("test for share documents file");
}
ShareExtend.share(testFile.path, "file");

///share multiple images
_shareMultipleImages() async {
  List<Asset> assetList = await MultiImagePicker.pickImages(maxImages: 5);
  var imageList = List<String>();
  for (var asset in assetList) {
    String path =
        await _writeByteToImageFile(await asset.getByteData(quality: 30));
    imageList.add(path);
  }
  ShareExtend.shareMultiple(imageList, "image",subject: "share muti image");
}

Future<String> _writeByteToImageFile(ByteData byteData) async {
  Directory dir = Platform.isAndroid
      ? await getExternalStorageDirectory()
      : await getApplicationDocumentsDirectory();
  File imageFile = new File(
      "${dir.path}/flutter/${DateTime.now().millisecondsSinceEpoch}.png");
  imageFile.createSync(recursive: true);
  imageFile.writeAsBytesSync(byteData.buffer.asUint8List(0));
  return imageFile.path;
}

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package