wc_flutter_share 0.0.1 copy "wc_flutter_share: ^0.0.1" to clipboard
wc_flutter_share: ^0.0.1 copied to clipboard

discontinuedreplaced by: share_plus
outdated

A Flutter plugin for sharing files & text with other applications.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:wc_flutter_share/wc_flutter_share.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('How to: wc_flutter_share'),
          textTheme: TextTheme(button: TextStyle(color: Colors.black)),
        ),
        body: ListView(
          children: <Widget>[
            SizedBox(
              height: 10,
            ),
            FlatButton(onPressed: _shareText, child: Text('Share text')),
            SizedBox(
              height: 10,
            ),
            FlatButton(onPressed: _shareImage, child: Text('Share file only')),
            SizedBox(
              height: 10,
            ),
            FlatButton(onPressed: _shareImageAndText, child: Text('Share file and text')),
          ],
        ),
      ),
    );
  }

  void _shareText() async {
    try {
      WcFlutterShare.text(
          'This is share title', 'This is share text', 'text/plain');
    } catch (e) {
      print(e);
    }
  }

  void _shareImage() async {
    try {
      final ByteData bytes = await rootBundle.load('assets/wisecrab.png');
      await WcFlutterShare.file(
          'This is popuptitle',
          null,
          null,
          'share.png',
          'image/png',
          bytes.buffer.asUint8List());
    } catch (e) {
      print('error: $e');
    }
  }

  void _shareImageAndText() async {
    try {
      final ByteData bytes = await rootBundle.load('assets/wisecrab.png');
      await WcFlutterShare.file(
          'This is share title',
          'This is share text',
          'This is subject text',
          'share.png',
          'image/png',
          bytes.buffer.asUint8List());
    } catch (e) {
      print('error: $e');
    }
  }
}
56
likes
0
pub points
90%
popularity

Publisher

verified publisherwisecrab.com

A Flutter plugin for sharing files & text with other applications.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, path_provider

More

Packages that depend on wc_flutter_share