clipboard_monitor 0.9.1
clipboard_monitor: ^0.9.1 copied to clipboard

Flutter Android iOS

Flutter plugin for monitoring system clipboard on Android and iOS.

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _clipboardText = '';
  final controller = TextEditingController();

  @override
  void initState() {
    super.initState();
    controller.text = 'Copy some text from here.\n1234 5678';
    ClipboardMonitor.registerCallback(onClipboardText);
  }

  @override
  void dispose() {
    ClipboardMonitor.unregisterCallback(onClipboardText);
    super.dispose();
  }

  void onClipboardText(String text) {
    print("clipboard changed: $text");
    setState(() {
      _clipboardText = text;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('clipboard_monitor example app'),
        ),
        body: Center(
          child: Column(
            children: [
              SizedBox(height: 10),
              Text('Clipboard text: $_clipboardText\n'),
              SizedBox(height: 30),
              TextField(maxLines: 5, controller: controller),
            ],
          ),
        ),
      ),
    );
  }
}
3
likes
100
pub points
38%
popularity

Flutter plugin for monitoring system clipboard on Android and iOS.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

mix1009@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on clipboard_monitor