uipasteboard 0.1.2 copy "uipasteboard: ^0.1.2" to clipboard
uipasteboard: ^0.1.2 copied to clipboard

PlatformiOS

A Flutter plugin to interact with UIPasteboard on iOS.

example/lib/main.dart

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

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  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('UIPasteboard')),
        floatingActionButton: FloatingActionButton(
          child: Icon(Icons.paste_sharp),
          onPressed: () async {
            final pasteboard = UIPasteboard();
            final hasUrl = await pasteboard.hasURLs();
            if (hasUrl) {
              final url = await pasteboard.getURL();
              if (!context.mounted) return;
              ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("$url")));
            } else {
              if (!context.mounted) return;
              ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text("No URL detected in the pasteboard.")));
            }
          },
        ),
      ),
    );
  }
}
2
likes
160
points
898
downloads

Publisher

verified publisherliplum.net

Weekly Downloads

A Flutter plugin to interact with UIPasteboard on iOS.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on uipasteboard

Packages that implement uipasteboard