flutter_share_plugin 0.1.3+3
flutter_share_plugin: ^0.1.3+3 copied to clipboard
Flutter plugin for sharing any files and text to other apps.
flutter_share_plugin #
Easily share content like text, image or any file to other apps.
Both Android and iOS platforms are supported, no additional changes are required in native code or projects. Except, the Specific permissions (like Storage Access permission), you'll need to add that in your project manually.
Install plugin: #
Visit https://pub.dev/packages/flutter_share_plugin#-installing-tab-
Import library: #
import 'package:flutter_share_plugin/flutter_share_plugin.dart';
copied to clipboard
That's it. Now, you are ready to go.
Usage Examples: #
Share only text: #
String text = "Check out this plugin: https://pub.dev/packages/flutter_share_plugin ";
FlutterShare.shareText(text);
copied to clipboard
Share only file: #
Example 1:
String filePath = bohemianRhapsodySong.absolute.path;
// pass the string as `filePath` parameter
FlutterShare.shareFile(filePath: filePath);
copied to clipboard
Example 2:
Uint8List bytes = bohemianRhapsodySong.readAsBytes();
// pass the Uint8List data as `bytes` parameter
FlutterShare.shareFile(bytes: bytes);
copied to clipboard
Share file and text content: #
Example 1:
// use preferred method here to get URI string of the file
String uri = screenshot.absolute.path;
String text = "Transaction Screenshot";
FlutterShare.shareFileWithText(
textContent: text, filePath: uri);
copied to clipboard
Example 2:
// use preferred method here to get bytes of the files
Uint8List bytes = screenshot.readAsBytes();
String text = "Transaction Screenshot";
FlutterShare.shareFileWithText(
textContent: text, bytes: bytes);
copied to clipboard
Screenshots: #
Share text only #
Share a file with text #