copyFile method
Read the content of path and copy it to the clipboard.
Implementation
Future<void> copyFile(String path) async {
final file = File(path);
if (!await file.exists()) {
throw FileSystemException('File not found', path);
}
final content = await file.readAsString();
final fileName = path.split(Platform.pathSeparator).last;
await copy(
content,
source: ClipboardSource.tool,
contentType: ClipboardContentType.code,
label: fileName,
);
}