Share Content with Flutter Share Plugin
By Philomathes in Mobile Development,Mobile Technology,Technology,Web Development
Are you creating a Flutter application that has content users may want to share with their friends or coworkers? Take advantage of the native platform share dialog using the share plugin. Let’s see how it’s done.
Adding the Share plugin
Head over to your pubspec.yaml and add the following plugin:
Add the following imports to your Dart code:
Adding the Share functionality
In order to make it so that whenever the user clicks on a widget, we’ll hook into the onTap functionality, calling a share function:
String text = ‘https://www.vayuz.co’;
String subject = ‘follow me’;
In this package you can add only two texts or String but you can configure it. Take any clickable widget, you can take reference Deep Dive Into Buttons & Clickable Widgets In Flutter.
final RenderBox box = context.findRenderObject();
And you are done. You have successfully implemented the share functionality in Flutter