simple_clipboard 1.0.0 copy "simple_clipboard: ^1.0.0" to clipboard
simple_clipboard: ^1.0.0 copied to clipboard

A simple Flutter plugin for copying and pasting text to/from the system clipboard. (Text-only, minimal implementation for learning.)

example/lib/main.dart

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

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

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

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

class _MyAppState extends State<MyApp> {
  String _pastedText = 'Nothing yet';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Simple Clipboard Plugin Test')),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () async {
                  await SimpleClipboard.copy('Hello from my plugin!');
                  ScaffoldMessenger.of(context).showSnackBar(
                    const SnackBar(content: Text('Copied!')),
                  );
                },
                child: const Text('Copy "Hello from my plugin!"'),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () async {
                  final text = await SimpleClipboard.paste();
                  setState(() {
                    _pastedText = text ?? 'Empty clipboard';
                  });
                },
                child: const Text('Paste from Clipboard'),
              ),
              const SizedBox(height: 20),
              Text('Pasted: $_pastedText'),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
140
points
121
downloads

Publisher

unverified uploader

Weekly Downloads

A simple Flutter plugin for copying and pasting text to/from the system clipboard. (Text-only, minimal implementation for learning.)

Homepage
Repository (GitLab)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on simple_clipboard

Packages that implement simple_clipboard