A Flutter plugin for launching a URL
and sharing files
in the mobile, web and desktop platforms. Supports iOS, Android, Web, Windows, Linux and macOS.
Note: Sharing files supports only on iOS, Android and Web. Desktop support is under development.
In order to use this plugin, add dependency in the pubspec.yaml
:
cross_share:
git:
url: https://github.com/marchdev-tk/cross_share
Add an import to dart file:
import 'package:cross_share/cross_share.dart';
Web sample:
Mobile sample:
Share().shareUrl(url: 'tel:0001112223');
The shareUrl
method
takes a string argument containing a URL. This URL
can be formatted using a number of different URL schemes. The supported
URL schemes depend on the underlying platform and installed apps.
Common schemes supported:
Scheme | Action |
---|---|
http:<URL> , https:<URL> , e.g. http://flutter.dev |
Open URL in the default browser |
mailto:<email address>?subject=<subject>&body=<body> , e.g. mailto:smith@example.org?subject=News&body=New%20plugin |
Create email to in the default email app |
tel:<phone number> , e.g. tel:+1 555 010 999 |
Make a phone call to using the default phone app |
sms:<phone number> , e.g. sms:5550101234 |
Send an SMS message to using the default messaging app |
Share().shareFile(
name: file.name,
bytes: file.bytes,
type: file.type,
);
where:
name
is a name of the filebytes
is a byte array of file to sharetype
is a MIME Type of the file to share
Feel free to post a feature requests or report a bug here.