share_and_open_url 0.0.7 copy "share_and_open_url: ^0.0.7" to clipboard
share_and_open_url: ^0.0.7 copied to clipboard

share_and_open_url_plugin provides functionality for sharing text and opening URLs. It allows users to easily share content and quickly access web links.

share_and_open_url provides functionality for sharing text and opening URLs. It allows users to easily share content and quickly access web links.

Table of contents #

Platforms #

✅ Android (Kotlin)

✅ iOS (Swift)

Installation #

dependencies:
  share_and_open_url: ^0.0.7

Usage #

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

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

class _MyAppState extends State<MyApp> {
  final ShareAndOpenUrl _shareAndOpenUrlPlugin = ShareAndOpenUrl();

  Future<void> _shareText() async {
    try {
      await _shareAndOpenUrlPlugin.shareText("Hello from Flutter!");
    } on PlatformException catch (e) {
      throw PlatformException(code: e.code, message: "Failed to share text: '${e.message}'.");
    }
  }

  Future<void> _openUrl() async {
    try {
      await _shareAndOpenUrlPlugin.openUrl("https://flutter.dev/");
    } on PlatformException catch (e) {
      throw PlatformException(code: e.code, message: "Failed to open url: '${e.message}'.");
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              ElevatedButton(
                onPressed: _shareText,
                child: const Text('Share Text'),
              ),
              ElevatedButton(
                onPressed: _openUrl,
                child: const Text('Open URL'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots #

License #

MIT

9
likes
160
points
43
downloads

Publisher

unverified uploader

Weekly Downloads

share_and_open_url_plugin provides functionality for sharing text and opening URLs. It allows users to easily share content and quickly access web links.

Repository (GitHub)
View/report issues

Topics

#share #url #plugin

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on share_and_open_url