copySelectionToClipboard method

Future<int> copySelectionToClipboard({
  1. bool includeHeader = false,
})

Copy the current selection to the system clipboard as TSV. Returns the number of rows written (0 ⇒ nothing selected).

Implementation

Future<int> copySelectionToClipboard({bool includeHeader = false}) async {
  final tsv = copySelectionAsTsv(includeHeader: includeHeader);
  if (tsv.isEmpty) return 0;
  await Clipboard.setData(ClipboardData(text: tsv));
  return '\n'.allMatches(tsv).length + 1;
}