复制:
ClipboardData data = new ClipboardData(text:"复制的内容");
Clipboard.setData(data);
粘贴:
Clipboard.getData('text');
注意
- 引用包:import 'package:flutter/services.dart';
- Clipboard.getData需要传入‘format’:The
format
argument specifies the media type, such astext/plain
, of the data to obtain.
网友评论