copySelection method Null safety

void copySelection()

Copy current selection to Clipboard.

Implementation

void copySelection() {
  final TextSelection selection = textSelectionDelegate.textEditingValue.selection;
  final String text = textSelectionDelegate.textEditingValue.text;
  assert(selection != null);
  if (!selection.isCollapsed) {
    Clipboard.setData(ClipboardData(text: selection.textInside(text)));
  }
}