flutter_share 1.0.2+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 95

Share Plugin #

pub package

A Flutter plugin for IOS and Android providing a simple way to share a message, link or local files.

Features: #

  • Share messages and/or link urls.
  • Share local files.

android         ios

Installation #

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

iOS #

Add if not exists one row to the ios/podfile after target runner:


target 'Runner' do


Android #

If you pretends to use the file share, you need to configure the file provider, this will give access to the files turning possible to share with other applications.

Add to AndroidManifest.xml:


Obs: You can change the android:name if you have an extension of file provider.

Add res/xml/provider_paths.xml:

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path name="external_files" path="."/>

If you want to learn more about file provider you can access:

Example #

Here is an example flutter app displaying the two shares methods. (I'm using documents_picker just to get a local file you don't need to use.)

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:flutter_share/flutter_share.dart';
import 'package:documents_picker/documents_picker.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  Future<void> share() async {
    await FlutterShare.share(
      title: 'Example share',
      text: 'Example share text',
      linkUrl: 'https://flutter.dev/',
      chooserTitle: 'Example Chooser Title'

  Future<void> shareFile() async {
    List<dynamic> docs = await DocumentsPicker.pickDocuments;
    if (docs == null || docs.isEmpty) return null;

    await FlutterShare.shareFile(
      title: 'Example share',
      text: 'Example share text',
      filePath: docs[0] as String,

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        body: Center(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
                child: Text('Share text and link'),
                onPressed: share,
                child: Text('Share local file'),
                onPressed: shareFile,

Feedback welcome and Pull Requests are most welcome!

1.0.2+1 #

  • Fix Android bug (FileUriExposedException) on new versions with FileProvider implementation (see the readme to configure)

1.0.1+1 #

  • Remove unused codes and improve description

1.0.1 #

  • Fix: Get the top most ViewController(IOS embedded support)

1.0.0 #

  • BREAKING CHANGE: Add support to AndroidX
  • BREAKING CHANGE: Separate in two methods share (to share messages and links) and shareFile (to share files)
  • Add ChooserTitle (Just for Android)
  • Add Text
  • Add Docs

0.0.5 #

  • Move documents_picker plugin to example project

0.0.1 #

  • Add file share.


flutter_share_example #

Demonstrates how to use the flutter_share plugin.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_share: ^1.0.2+1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_share/flutter_share.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 25, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
pedantic ^1.8.0+1