Ad

How To Share A File Using Flutter

- 1 answer

I am wondering how to share a file in a flutter app?

I saw some old references to using Intents with mojo, but that no longer seems to be present. This seems like a standard feature that we should be able to handle in a cross-platform way (obviously with some differences between ios to android).

What is the current best practices for sharing files (e.g. via email)? The closest thing I could fine is UrlLauncher, which I could imagine using to launch a handler for a file that I want shared, but it seems a stretch.

Ad

Answer

For anybody still finding this question, you can now share something with the share plugin: https://pub.dartlang.org/packages/share

Edit: This plugin only supports text/link share which is not sufficient for directly sharing files. The issues https://github.com/flutter/flutter/issues/16743 and https://github.com/flutter/flutter/issues/19607 track file sharing directly in flutter.

Ad
source: stackoverflow.com
Ad