flutter_share_me 0.5.0

flutter_share_me #

pub package

Flutter Plugin for sharing contents to social media.

You can use it share to Facebook , WhatsApp , Twitter And System Share UI. Support Url and Text.

Only Android because I don't have a Mac.

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and Pull Requests are most welcome!

Getting Started #

add flutter_share_me as a dependency in your pubspec.yaml file.

Please check the latest version before installation.

dependencies:
  flutter:
    sdk: flutter
  # add flutter_ScreenUtil
  flutter_share_me: ^0.4.0

Usage #

Add the following imports to your Dart code: #

import 'package:flutter_share_me/flutter_share_me.dart';

Add facebook id #

Add "facebook app id" to the application tag of AndroidManifest.xml

    <application>
       ...
       //add this 
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />
            
    </application>

Methods #

shareToFacebook({String msg, String url}) #

shareToTwitter({String msg, String url}) #

shareToWhatsApp({String msg,String base64Image}) #

shareToSystem({String msg}) use system share ui #

These methods will return "success" if they successfully jump to the corresponding app.

ParameterDescription
String msgText message
String urlUrl url
String base64ImageImage base64

Example #

 Container(
           width: double.infinity,
           child: Column(
             crossAxisAlignment: CrossAxisAlignment.center,
             children: <Widget>[
               Image.memory(
                 base64.decode(base64Image.split(',')[1]),
                 height: 312,
                 width: 175.3,
                 fit: BoxFit.fill,
                 gaplessPlayback: true,
               ),
               SizedBox(height: 30),
               RaisedButton(
                 child: Text('share to twitter'),
                 onPressed: () async {
                   var response = await FlutterShareMe().shareToTwitter(
                       url: 'https://github.com/lizhuoyuan', msg: msg);
                   if (response == 'success') {
                     print('navigate success');
                   }
                 },
               ),
               RaisedButton(
                 child: Text('share to shareWhatsApp'),
                 onPressed: () {
                   FlutterShareMe()
                       .shareToWhatsApp(base64ImageUrl: base64Image, msg: msg);
                 },
               ),
               RaisedButton(
                 child: Text('share to shareFacebook'),
                 onPressed: () {
                   FlutterShareMe().shareToFacebook(
                       url: 'https://github.com/lizhuoyuan', msg: msg);
                 },
               ),
               RaisedButton(
                 child: Text('share to System'),
                 onPressed: () async {
                   var response = await FlutterShareMe().shareToSystem(msg: msg);
                   if (response == 'success') {
                     print('navigate success');
                   }
                 },
               ),
             ],
           ),
         )

0.5.0 #

change Key "base64ImageUrl" to "base64Image".

0.4.0 #

Support sharing pictures to whatsapp

0.3.1 #

Allow developers to enter their own facebook id Delete useless code

0.3.0 #

Allow developers to enter their own facebook id

0.2.1 #

Fix issue #5

0.2.0 #

Migrated to AndroidX

0.0.1 #

  • TODO: Describe initial release.

example/README.md

flutter_share_me_example #

Demonstrates how to use the flutter_share_me plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_share_me: ^0.5.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_share_me/flutter_share_me.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
89
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
95
Learn more about scoring.

We analyzed this package on Aug 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8