paste method

Future<void> paste()

Pastes text from the clipboard at the current cursor position.

Replaces any selected text with the pasted content.

Implementation

Future<void> paste() async {
  final data = await Clipboard.getData(Clipboard.kTextPlain);
  if (data?.text == null || data!.text!.isEmpty) return;
  final sel = selection;
  replaceRange(sel.start, sel.end, data.text!);
}