Skip to content
pubscout

flutter_sharing_intent

2.0.4, released 12 months ago by techind.co

Receive shared photos, videos, text, and files from other apps.

WASM-ready
$ flutter pub add flutter_sharing_intent
Source repository

What it does

Allows your Flutter application to act as a share target, receiving content like images, videos, text, URLs, and files shared from other apps. It provides methods to handle initial sharing when the app opens and listens to a stream for incoming shares while the app is running.

AI-written summary of version 2.0.4, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Your app needs to accept shared media or text from external applications via the OS share sheet.
  • You want to process incoming URLs, photos, or documents sent from another app.

Skip it when

  • You only need to pick files from within your own app (use file_picker instead).
  • You do not want to configure native Android intent filters and iOS Share Extensions.

Strengths

  • Supports multiple types of media including images, videos, text, and files.
  • Provides both stream subscriptions for active app states and initial sharing retrieval.

Weaknesses

  • Requires manual and intricate native setup for both Android Manifest and iOS Share Extension.
  • iOS implementation requires setting up an App Group and an extension target.

Setup

Kind
Plugin (native code)
Effort
High
Code generation
No
Direct dependencies
1

Requires adding intent filters in AndroidManifest.xml and creating a Share Extension target with an App Group and custom Swift view controller on iOS.

import 'package:flutter/material.dart';
import 'package:flutter_sharing_intent/flutter_sharing_intent.dart';
import 'package:flutter_sharing_intent/model/sharing_file.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  List<SharedFile>? list;

  @override
  void initState() {
    super.initState();
    FlutterSharing_intent.instance.getInitialSharing().then((List<SharedFile> value) {
      setState(() {
        list = value;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Text('Sharing data: \n${list?.join("\n\n")}\n'),
        ),
      ),
    );
  }
}

Alternatives

Packages that do the same job and could replace flutter_sharing_intent.

Works with

Packages commonly used together with flutter_sharing_intent: ones it builds on, ones built on it, and its own family.