share_plugin_plus 0.0.2+2 copy "share_plugin_plus: ^0.0.2+2" to clipboard
share_plugin_plus: ^0.0.2+2 copied to clipboard

PlatformAndroid

A flutter plugin Share to Android System, And return the shared status and shared platform

example/lib/main.dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import 'package:share_plugin/share_plugin_plus.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: TextButton(onPressed: _shareImpl,style: ButtonStyle(backgroundColor: MaterialStateColor.resolveWith((states) => Colors.amber)),child: const Text('Share Text'),),
        ),
      ),
    );
  }

  void _shareImpl() async {
    var text = "This is a piece of text used to test the share function";
    var result = await SharePlugin.share(text, ShareType.TEXT);
    if (kDebugMode) {
      print('share result status is ${result.status},share platform is ${result.platform}');
    }
  }
}
0
likes
120
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter plugin Share to Android System, And return the shared status and shared platform

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on share_plugin_plus

Packages that implement share_plugin_plus