handlePaste method

  1. @override
Future<void> handlePaste(
  1. TextSelectionDelegate delegate
)
override

Call TextSelectionDelegate.pasteText to paste text.

This is called by subclasses when their paste affordance is activated by the user.

This function is asynchronous since interacting with the clipboard is asynchronous. Race conditions may exist with this API as currently implemented.

Implementation

@override
Future<void> handlePaste(TextSelectionDelegate delegate) async {
  final data = await Clipboard.getData(Clipboard.kTextPlain);
  if (data?.text?.isNotEmpty ?? false) pasteMethod(data!.text!);
}