Reputation: 477
I searched in google for how to copy an image to clipboard in flutter but I did not find any useful information. I only found in flutter documentation this:
"ClipboardData class:
Data stored on the system clipboard.
The system clipboard can contain data of various media types. This data structure currently supports only plain text data, in the text property."
https://api.flutter.dev/flutter/services/ClipboardData-class.html
Is it impossible to copy an image to clipboard in flutter right now?
Upvotes: 4
Views: 2299
Reputation: 249
This package allows copying images to the clipboard:
https://github.com/superlistapp/super_native_extensions/tree/main/super_clipboard
final item = DataWriterItem();
item.add(Formats.png(imageData));
await ClipboardWriter.instance.write([item]);
There's some other steps to follow to get it setup in their README, but I managed to get it working.
Upvotes: 1
Reputation: 5943
I did not try and not sure if the answer is you looking for but you can give a try that first you can convert your image to Uint8List format with BASE64 decode and encode then copy it. for conversion you can check this. link
how-to-convert-base64-string-into-image-with-flutter
also check answers of this threat
how-to-send-image-through-post-using-json-in-flutter
Upvotes: 1