fluttet_clipboard.dart 423 Bytes
Newer Older
李增强's avatar
李增强 committed
1 2 3 4
import 'dart:async';
import 'package:flutter/services.dart';

class FluttetClipboard {
汪林玲's avatar
汪林玲 committed
5
  static const MethodChannel _channel = const MethodChannel('fluttet_clipboard');
李增强's avatar
李增强 committed
6

7 8
  static Future<String?> getText() async {
    String? text = await _channel.invokeMethod('getClipboard');
李增强's avatar
李增强 committed
9 10 11
    return text;
  }

12
  static Future<bool?> setText(String text) async {
汪林玲's avatar
汪林玲 committed
13
    return _channel.invokeMethod('setClipboard', {'text': text});
李增强's avatar
李增强 committed
14 15
  }
}